Skip to content

Commit 60c3673

Browse files
committed
Auto merge of rust-lang#130454 - durin42:llvm-20-notrunc, r=workingjubilee
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 r? `@DianQK`
2 parents f7b4c72 + 9692513 commit 60c3673

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: tests/codegen/try_question_mark_nop.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
//@ compile-flags: -O -Z merge-functions=disabled --edition=2021
22
//@ only-x86_64
33
// FIXME: Remove the `min-llvm-version`.
4-
//@ min-llvm-version: 19
4+
//@ revisions: NINETEEN TWENTY
5+
//@[NINETEEN] min-llvm-version: 19
6+
//@[NINETEEN] ignore-llvm-version: 20-99
7+
//@[TWENTY] min-llvm-version: 20
58

69
#![crate_type = "lib"]
710
#![feature(try_blocks)]
811

912
use std::ops::ControlFlow::{self, Break, Continue};
1013
use std::ptr::NonNull;
1114

12-
// FIXME: The `trunc` and `select` instructions can be eliminated.
1315
// CHECK-LABEL: @option_nop_match_32
1416
#[no_mangle]
1517
pub fn option_nop_match_32(x: Option<u32>) -> Option<u32> {
1618
// CHECK: start:
17-
// CHECK-NEXT: [[TRUNC:%.*]] = trunc nuw i32 %0 to i1
18-
// CHECK-NEXT: [[FIRST:%.*]] = select i1 [[TRUNC]], i32 %0
19-
// CHECK-NEXT: insertvalue { i32, i32 } poison, i32 [[FIRST]]
19+
// NINETEEN-NEXT: [[TRUNC:%.*]] = trunc nuw i32 %0 to i1
20+
// NINETEEN-NEXT: [[FIRST:%.*]] = select i1 [[TRUNC]], i32 %0
21+
// NINETEEN-NEXT: insertvalue { i32, i32 } poison, i32 [[FIRST]], 0
22+
// TWENTY-NEXT: insertvalue { i32, i32 } poison, i32 %0, 0
2023
// CHECK-NEXT: insertvalue { i32, i32 }
2124
// CHECK-NEXT: ret { i32, i32 }
2225
match x {

0 commit comments

Comments
 (0)