about summary refs log tree commit diff
path: root/tests/codegen/try_question_mark_nop.rs
AgeCommit message (Collapse)AuthorLines
2025-04-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-1/+2
2025-04-05Update the minimum external LLVM to 19Josh Stone-2/+0
2025-04-03Remove `unsound-mir-opts` for `simplify_aggregate_to_copy`dianqk-14/+24
2025-03-16Auto merge of #137278 - heiseish:101210-extra-codegen-tests, r=scottmcmbors-20/+121
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`
2025-03-12added some new test to check for result and options optGiang Dao-20/+121
2025-03-12Don't `alloca` just to look at a discriminantScott McMurray-3/+3
Today we're making LLVM do a bunch of extra work for every enum you match on, even trivial stuff like `Option<bool>`. Let's not.
2025-03-06Use `trunc nuw`+`br` for 0/1 branches even in optimized buildsScott McMurray-4/+4
Rather than needing to use `switch` for them to include the `unreachable` arm
2025-02-11tests/codegen: use -Copt-level=3 instead of -OJubilee Young-1/+1
2024-11-13Add ``exact-llvm-major-version`` directiveKirill Podoprigora-2/+1
2024-11-08try_question_mark_nop: update test for LLVM 20Augie Fackler-1/+10
llvm/llvm-project@dd116369f646d023a2e7e5c145a1bed5dcf9a45c changes the IR of this test in a way that I don't think is bad, but needs adjusting. r? @nikic @rustbot label: +llvm-main
2024-10-31Mark `simplify_aggregate_to_copy` mir-opt as unsound许杰友 Jieyou Xu (Joe)-10/+4
Co-authored-by: DianQK <dianqk@dianqk.net>
2024-09-17tests: allow trunc/select instructions to be missingAugie Fackler-5/+8
On LLVM 20, these instructions already get eliminated, which at least partially satisfies a TODO. I'm not talented enough at using FileCheck to try and constrain this further, but if we really want to we could copy an LLVM 20 specific version of this test that would restore it to being CHECK-NEXT: insertvalue ... @rustbot label: +llvm-main
2024-09-14Update try_question_mark_nop.rs testDianQK-1/+6
2024-05-31Run rustfmt on `tests/codegen/`.Nicholas Nethercote-16/+6
Except for `simd-intrinsic/`, which has a lot of files containing multiple types like `u8x64` which really are better when hand-formatted. There is a surprising amount of two-space indenting in this directory. Non-trivial changes: - `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the test. - `rustfmt::skip` used in a few places where hand-formatting read more nicely: `enum/enum-match.rs` - Line number adjustments needed for the expected output of `debug-column.rs` and `coroutine-debug.rs`.
2024-02-27allow using scalarpair with a common prim of ptr/ptr-sized-intErik Desjardins-12/+92
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-2/+2
2023-07-27Update the minimum external LLVM to 15Josh Stone-1/+0
2023-01-11Move /src/test to /testsAlbert Larsan-0/+54