Skip to content

Commit 9a8dc7e

Browse files
committed
Replace uses of 'CHECK: br' and 'CHECK-NOT: br' with 'br {{.*}}'.
v0 mangling can produce symbols with 'br' as a substring, leading to false positives for CHECK-NOT
1 parent e22dab3 commit 9a8dc7e

13 files changed

+53
-53
lines changed

tests/codegen-llvm/char-ascii-branchless.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,41 @@
77
// CHECK-LABEL: @is_ascii_alphanumeric_char
88
#[no_mangle]
99
pub fn is_ascii_alphanumeric_char(x: char) -> bool {
10-
// CHECK-NOT: br
10+
// CHECK-NOT: br {{.*}}
1111
x.is_ascii_alphanumeric()
1212
}
1313

1414
// CHECK-LABEL: @is_ascii_alphanumeric_u8
1515
#[no_mangle]
1616
pub fn is_ascii_alphanumeric_u8(x: u8) -> bool {
17-
// CHECK-NOT: br
17+
// CHECK-NOT: br {{.*}}
1818
x.is_ascii_alphanumeric()
1919
}
2020

2121
// CHECK-LABEL: @is_ascii_hexdigit_char
2222
#[no_mangle]
2323
pub fn is_ascii_hexdigit_char(x: char) -> bool {
24-
// CHECK-NOT: br
24+
// CHECK-NOT: br {{.*}}
2525
x.is_ascii_hexdigit()
2626
}
2727

2828
// CHECK-LABEL: @is_ascii_hexdigit_u8
2929
#[no_mangle]
3030
pub fn is_ascii_hexdigit_u8(x: u8) -> bool {
31-
// CHECK-NOT: br
31+
// CHECK-NOT: br {{.*}}
3232
x.is_ascii_hexdigit()
3333
}
3434

3535
// CHECK-LABEL: @is_ascii_punctuation_char
3636
#[no_mangle]
3737
pub fn is_ascii_punctuation_char(x: char) -> bool {
38-
// CHECK-NOT: br
38+
// CHECK-NOT: br {{.*}}
3939
x.is_ascii_punctuation()
4040
}
4141

4242
// CHECK-LABEL: @is_ascii_punctuation_u8
4343
#[no_mangle]
4444
pub fn is_ascii_punctuation_u8(x: u8) -> bool {
45-
// CHECK-NOT: br
45+
// CHECK-NOT: br {{.*}}
4646
x.is_ascii_punctuation()
4747
}

tests/codegen-llvm/enum/enum-early-otherwise-branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub enum Enum {
1212
pub fn foo(lhs: &Enum, rhs: &Enum) -> bool {
1313
// CHECK-LABEL: define{{.*}}i1 @foo(
1414
// CHECK-NOT: switch
15-
// CHECK-NOT: br
15+
// CHECK-NOT: br {{.*}}
1616
// CHECK: [[SELECT:%.*]] = select
1717
// CHECK-NEXT: ret i1 [[SELECT]]
1818
// CHECK-NEXT: }

tests/codegen-llvm/issues/cows-dont-have-branches-117763.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// CHECK-LABEL: @branchless_cow_slices
1010
#[no_mangle]
1111
pub fn branchless_cow_slices<'a>(cow: &'a std::borrow::Cow<'a, [u8]>) -> &'a [u8] {
12-
// CHECK-NOT: br
12+
// CHECK-NOT: br {{.*}}
1313
// CHECK-NOT: select
1414
// CHECK-NOT: icmp
1515
// CHECK: ret { ptr, {{i32|i64}} }

tests/codegen-llvm/issues/issue-107681-unwrap_unchecked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::slice::Iter;
1111
#[no_mangle]
1212
pub unsafe fn foo(x: &mut Copied<Iter<'_, u32>>) -> u32 {
1313
// CHECK-LABEL: @foo(
14-
// CHECK-NOT: br
14+
// CHECK-NOT: br {{.*}}
1515
// CHECK-NOT: select
1616
// CHECK: [[RET:%.*]] = load i32, ptr
1717
// CHECK-NEXT: ret i32 [[RET]]

tests/codegen-llvm/issues/issue-108395-branchy-bool-match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// CHECK-LABEL: @wildcard(
77
#[no_mangle]
88
pub fn wildcard(a: u16, b: u16, v: u16) -> u16 {
9-
// CHECK-NOT: br
9+
// CHECK-NOT: br {{.*}}
1010
match (a == v, b == v) {
1111
(true, false) => 0,
1212
(false, true) => u16::MAX,
@@ -17,7 +17,7 @@ pub fn wildcard(a: u16, b: u16, v: u16) -> u16 {
1717
// CHECK-LABEL: @exhaustive(
1818
#[no_mangle]
1919
pub fn exhaustive(a: u16, b: u16, v: u16) -> u16 {
20-
// CHECK-NOT: br
20+
// CHECK-NOT: br {{.*}}
2121
match (a == v, b == v) {
2222
(true, false) => 0,
2323
(false, true) => u16::MAX,

tests/codegen-llvm/issues/issue-119422.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,65 +19,65 @@ pub fn check_non_null(x: NonNull<u8>) -> bool {
1919
// CHECK-LABEL: @equals_zero_is_false_u8
2020
#[no_mangle]
2121
pub fn equals_zero_is_false_u8(x: NonZero<u8>) -> bool {
22-
// CHECK-NOT: br
22+
// CHECK-NOT: br {{.*}}
2323
// CHECK: ret i1 false
24-
// CHECK-NOT: br
24+
// CHECK-NOT: br {{.*}}
2525
x.get() == 0
2626
}
2727

2828
// CHECK-LABEL: @not_equals_zero_is_true_u8
2929
#[no_mangle]
3030
pub fn not_equals_zero_is_true_u8(x: NonZero<u8>) -> bool {
31-
// CHECK-NOT: br
31+
// CHECK-NOT: br {{.*}}
3232
// CHECK: ret i1 true
33-
// CHECK-NOT: br
33+
// CHECK-NOT: br {{.*}}
3434
x.get() != 0
3535
}
3636

3737
// CHECK-LABEL: @equals_zero_is_false_i8
3838
#[no_mangle]
3939
pub fn equals_zero_is_false_i8(x: NonZero<i8>) -> bool {
40-
// CHECK-NOT: br
40+
// CHECK-NOT: br {{.*}}
4141
// CHECK: ret i1 false
42-
// CHECK-NOT: br
42+
// CHECK-NOT: br {{.*}}
4343
x.get() == 0
4444
}
4545

4646
// CHECK-LABEL: @not_equals_zero_is_true_i8
4747
#[no_mangle]
4848
pub fn not_equals_zero_is_true_i8(x: NonZero<i8>) -> bool {
49-
// CHECK-NOT: br
49+
// CHECK-NOT: br {{.*}}
5050
// CHECK: ret i1 true
51-
// CHECK-NOT: br
51+
// CHECK-NOT: br {{.*}}
5252
x.get() != 0
5353
}
5454

5555
// CHECK-LABEL: @usize_try_from_u32
5656
#[no_mangle]
5757
pub fn usize_try_from_u32(x: NonZero<u32>) -> NonZero<usize> {
58-
// CHECK-NOT: br
58+
// CHECK-NOT: br {{.*}}
5959
// CHECK: zext i32 %{{.*}} to i64
60-
// CHECK-NOT: br
60+
// CHECK-NOT: br {{.*}}
6161
// CHECK: ret i64
6262
x.try_into().unwrap()
6363
}
6464

6565
// CHECK-LABEL: @isize_try_from_i32
6666
#[no_mangle]
6767
pub fn isize_try_from_i32(x: NonZero<i32>) -> NonZero<isize> {
68-
// CHECK-NOT: br
68+
// CHECK-NOT: br {{.*}}
6969
// CHECK: sext i32 %{{.*}} to i64
70-
// CHECK-NOT: br
70+
// CHECK-NOT: br {{.*}}
7171
// CHECK: ret i64
7272
x.try_into().unwrap()
7373
}
7474

7575
// CHECK-LABEL: @u64_from_nonzero_is_not_zero
7676
#[no_mangle]
7777
pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>) -> bool {
78-
// CHECK-NOT: br
78+
// CHECK-NOT: br {{.*}}
7979
// CHECK: ret i1 false
80-
// CHECK-NOT: br
80+
// CHECK-NOT: br {{.*}}
8181
let v: u64 = x.into();
8282
v == 0
8383
}

tests/codegen-llvm/issues/issue-73258.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ pub enum Foo {
1818
pub unsafe fn issue_73258(ptr: *const Foo) -> Foo {
1919
// CHECK-NOT: icmp
2020
// CHECK-NOT: call
21-
// CHECK-NOT: br
21+
// CHECK-NOT: br {{.*}}
2222
// CHECK-NOT: select
2323

2424
// CHECK: %[[R:.+]] = load i8
2525
// CHECK-SAME: !range !
2626

2727
// CHECK-NOT: icmp
2828
// CHECK-NOT: call
29-
// CHECK-NOT: br
29+
// CHECK-NOT: br {{.*}}
3030
// CHECK-NOT: select
3131

3232
// CHECK: ret i8 %[[R]]
3333

3434
// CHECK-NOT: icmp
3535
// CHECK-NOT: call
36-
// CHECK-NOT: br
36+
// CHECK-NOT: br {{.*}}
3737
// CHECK-NOT: select
3838
let k: Option<Foo> = Some(ptr.read());
3939
return k.unwrap();

tests/codegen-llvm/issues/num-is-digit-to-digit-59352.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// CHECK-LABEL: @num_to_digit_slow
99
#[no_mangle]
1010
pub fn num_to_digit_slow(num: char) -> u32 {
11-
// CHECK-NOT: br
11+
// CHECK-NOT: br {{.*}}
1212
// CHECK-NOT: panic
1313
if num.is_digit(8) { num.to_digit(8).unwrap() } else { 0 }
1414
}

tests/codegen-llvm/iter-repeat-n-trivial-drop.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ impl Drop for NotCopy {
1919
// CHECK-LABEL: @iter_repeat_n_next
2020
pub fn iter_repeat_n_next(it: &mut std::iter::RepeatN<NotCopy>) -> Option<NotCopy> {
2121
// CHECK-NEXT: start:
22-
// CHECK-NOT: br
22+
// CHECK-NOT: br {{.*}}
2323
// CHECK: %[[COUNT:.+]] = load i64
2424
// CHECK-NEXT: %[[COUNT_ZERO:.+]] = icmp eq i64 %[[COUNT]], 0
2525
// CHECK-NEXT: br i1 %[[COUNT_ZERO]], label %[[EMPTY:.+]], label %[[NOT_EMPTY:.+]]
2626

2727
// CHECK: [[NOT_EMPTY]]:
28-
// CHECK-NOT: br
28+
// CHECK-NOT: br {{.*}}
2929
// CHECK: %[[DEC:.+]] = add i64 %[[COUNT]], -1
3030
// CHECK-NEXT: %[[VAL:.+]] = load i16
3131
// CHECK-NEXT: store i64 %[[DEC]]
3232
// CHECK-NEXT: br label %[[EMPTY]]
3333

3434
// CHECK: [[EMPTY]]:
35-
// CHECK-NOT: br
35+
// CHECK-NOT: br {{.*}}
3636
// CHECK: phi i16
3737
// CHECK-SAME: [ %[[VAL]], %[[NOT_EMPTY]] ]
38-
// CHECK-NOT: br
38+
// CHECK-NOT: br {{.*}}
3939
// CHECK: ret
4040

4141
it.next()

tests/codegen-llvm/option-as-slice.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ use core::option::Option;
1111
#[no_mangle]
1212
pub fn u64_opt_as_slice(o: &Option<u64>) -> &[u64] {
1313
// CHECK-NOT: select
14-
// CHECK-NOT: br
14+
// CHECK-NOT: br {{.*}}
1515
// CHECK-NOT: switch
1616
// CHECK-NOT: icmp
1717
// CHECK: %[[LEN:.+]] = load i64
1818
// CHECK-SAME: !range ![[META_U64:[0-9]+]],
1919
// CHECK-SAME: !noundef
2020
// CHECK-NOT: select
21-
// CHECK-NOT: br
21+
// CHECK-NOT: br {{.*}}
2222
// CHECK-NOT: switch
2323
// CHECK-NOT: icmp
2424
// CHECK: %[[T0:.+]] = insertvalue { ptr, i64 } poison, ptr %{{.+}}, 0
@@ -31,13 +31,13 @@ pub fn u64_opt_as_slice(o: &Option<u64>) -> &[u64] {
3131
#[no_mangle]
3232
pub fn nonzero_u64_opt_as_slice(o: &Option<NonZero<u64>>) -> &[NonZero<u64>] {
3333
// CHECK-NOT: select
34-
// CHECK-NOT: br
34+
// CHECK-NOT: br {{.*}}
3535
// CHECK-NOT: switch
3636
// CHECK-NOT: icmp
3737
// CHECK: %[[NZ:.+]] = icmp ne i64 %{{.+}}, 0
3838
// CHECK-NEXT: %[[LEN:.+]] = zext i1 %[[NZ]] to i64
3939
// CHECK-NOT: select
40-
// CHECK-NOT: br
40+
// CHECK-NOT: br {{.*}}
4141
// CHECK-NOT: switch
4242
// CHECK-NOT: icmp
4343
// CHECK: %[[T0:.+]] = insertvalue { ptr, i64 } poison, ptr %o, 0
@@ -50,15 +50,15 @@ pub fn nonzero_u64_opt_as_slice(o: &Option<NonZero<u64>>) -> &[NonZero<u64>] {
5050
#[no_mangle]
5151
pub fn u8_opt_as_slice(o: &Option<u8>) -> &[u8] {
5252
// CHECK-NOT: select
53-
// CHECK-NOT: br
53+
// CHECK-NOT: br {{.*}}
5454
// CHECK-NOT: switch
5555
// CHECK-NOT: icmp
5656
// CHECK: %[[TAG:.+]] = load i8
5757
// CHECK-SAME: !range ![[META_U8:[0-9]+]],
5858
// CHECK-SAME: !noundef
5959
// CHECK: %[[LEN:.+]] = zext{{.*}} i8 %[[TAG]] to i64
6060
// CHECK-NOT: select
61-
// CHECK-NOT: br
61+
// CHECK-NOT: br {{.*}}
6262
// CHECK-NOT: switch
6363
// CHECK-NOT: icmp
6464
// CHECK: %[[T0:.+]] = insertvalue { ptr, i64 } poison, ptr %{{.+}}, 0

0 commit comments

Comments
 (0)