diff options
| author | bors <bors@rust-lang.org> | 2025-03-16 05:17:07 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-16 05:17:07 +0000 |
| commit | 5f3b84a42199278114b6e3d95f406de05e0446f4 (patch) | |
| tree | 7b0bbfd6e3e9e587439fe165a70768cb196a67e2 /tests/rustdoc-ui/remap-path-prefix-macro.rs | |
| parent | 66678e68227913a42438afc7320a2849dffd4d51 (diff) | |
| parent | 0fba203d9e9457c0c2611cfdd587b3262737cecf (diff) | |
| download | rust-5f3b84a42199278114b6e3d95f406de05e0446f4.tar.gz rust-5f3b84a42199278114b6e3d95f406de05e0446f4.zip | |
Auto merge of #137278 - heiseish:101210-extra-codegen-tests, r=scottmcm
added some new test to check for result and options opt
Apologies for the delay. Finally have some time to get back into contributing.
## Context
- Added some tests to show optimization on result and options for 64 and 128 bits
- Relevant issue https://github.com/rust-lang/rust/issues/101210
## Some newb questions from me
- [x] My local llvm IR has `nuw` in `result_nop_match_128` etc whereas [godbolt version](https://rust.godbolt.org/z/Td9zoT5zn) doesn't have. So I put optional there, but not sure if it's desirable (maybe I'm not using the compiled llvm in the repo). I ran the test with
```bash
./x test tests/codegen/try_question_mark_nop.rs
```
- [x] Unless I'm reading it wrongly, but `option_nop_match_128` and `option_nop_traits_128` look to be **not** optimized away?
Update:
Here's the test for future reference
```rust
// CHECK-LABEL: `@option_nop_match_128`
#[no_mangle]
pub fn option_nop_match_128(x: Option<i128>) -> Option<i128> {
// CHECK: start:
// CHECK-NEXT: %trunc = trunc nuw i128 %0 to i1
// CHECK-NEXT: br i1 %trunc, label %bb3, label %bb4
// CHECK: bb3:
// CHECK-NEXT: %2 = getelementptr inbounds {{(nuw )?}}i8, ptr %_0, i64 16
// CHECK-NEXT: store i128 %1, ptr %2, align 16
// CHECK: bb4:
// CHECK-NEXT: %storemerge = phi i128 [ 1, %bb3 ], [ 0, %start ]
// CHECK-NEXT: store i128 %storemerge, ptr %_0, align 16
// CHECK-NEXT: ret void
match x {
Some(x) => Some(x),
None => None,
}
}
```
r? `@scottmcm`
Diffstat (limited to 'tests/rustdoc-ui/remap-path-prefix-macro.rs')
0 files changed, 0 insertions, 0 deletions
