about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAugie Fackler <augie@google.com>2024-09-16 20:46:46 -0400
committerAugie Fackler <augie@google.com>2024-09-17 08:55:26 -0400
commit9692513b7e71ea84d00adc3e0174ea865138aac6 (patch)
tree7239416fee1e84844a8595fe67d38345d89b283e
parent2e367d94f05f3c6170f4d49f5e387cfaa0c42c32 (diff)
downloadrust-9692513b7e71ea84d00adc3e0174ea865138aac6.tar.gz
rust-9692513b7e71ea84d00adc3e0174ea865138aac6.zip
tests: allow trunc/select instructions to be missing
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
-rw-r--r--tests/codegen/try_question_mark_nop.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/codegen/try_question_mark_nop.rs b/tests/codegen/try_question_mark_nop.rs
index 321067d1b90..65167f5c5af 100644
--- a/tests/codegen/try_question_mark_nop.rs
+++ b/tests/codegen/try_question_mark_nop.rs
@@ -1,7 +1,10 @@
 //@ compile-flags: -O -Z merge-functions=disabled --edition=2021
 //@ only-x86_64
 // FIXME: Remove the `min-llvm-version`.
-//@ min-llvm-version: 19
+//@ revisions: NINETEEN TWENTY
+//@[NINETEEN] min-llvm-version: 19
+//@[NINETEEN] ignore-llvm-version: 20-99
+//@[TWENTY] min-llvm-version: 20
 
 #![crate_type = "lib"]
 #![feature(try_blocks)]
@@ -9,14 +12,14 @@
 use std::ops::ControlFlow::{self, Break, Continue};
 use std::ptr::NonNull;
 
-// FIXME: The `trunc` and `select` instructions can be eliminated.
 // CHECK-LABEL: @option_nop_match_32
 #[no_mangle]
 pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
     // CHECK: start:
-    // CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i32 %0 to i1
-    // CHECK-NEXT: [[FIRST:%.*]] = select i1 [[TRUNC]], i32 %0
-    // CHECK-NEXT: insertvalue { i32, i32 } poison, i32 [[FIRST]]
+    // NINETEEN-NEXT: [[TRUNC:%.*]] = trunc nuw i32 %0 to i1
+    // NINETEEN-NEXT: [[FIRST:%.*]] = select i1 [[TRUNC]], i32 %0
+    // NINETEEN-NEXT: insertvalue { i32, i32 } poison, i32 [[FIRST]], 0
+    // TWENTY-NEXT: insertvalue { i32, i32 } poison, i32 %0, 0
     // CHECK-NEXT: insertvalue { i32, i32 }
     // CHECK-NEXT: ret { i32, i32 }
     match x {