Skip to content

Commit 93de97d

Browse files
authored
[SCCP] Swap out range metadata to range attribute (#90134)
Also moved the range from the function's call sites to the functions return value as that is possible now.
1 parent a8c88de commit 93de97d

19 files changed

+269
-207
lines changed

clang/test/CodeGen/X86/ms-x86-intrinsics.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ long long test__readfsqword(unsigned long Offset) {
4848
__int64 test__emul(int a, int b) {
4949
return __emul(a, b);
5050
}
51-
// CHECK-LABEL: define dso_local i64 @test__emul(i32 noundef %a, i32 noundef %b)
51+
// CHECK-LABEL: define dso_local range(i64 -4611686016279904256, 4611686018427387905) i64 @test__emul(i32 noundef %a, i32 noundef %b)
5252
// CHECK: [[X:%[0-9]+]] = sext i32 %a to i64
5353
// CHECK: [[Y:%[0-9]+]] = sext i32 %b to i64
5454
// CHECK: [[RES:%[0-9]+]] = mul nsw i64 [[Y]], [[X]]
@@ -57,7 +57,7 @@ __int64 test__emul(int a, int b) {
5757
unsigned __int64 test__emulu(unsigned int a, unsigned int b) {
5858
return __emulu(a, b);
5959
}
60-
// CHECK-LABEL: define dso_local i64 @test__emulu(i32 noundef %a, i32 noundef %b)
60+
// CHECK-LABEL: define dso_local range(i64 0, -8589934590) i64 @test__emulu(i32 noundef %a, i32 noundef %b)
6161
// CHECK: [[X:%[0-9]+]] = zext i32 %a to i64
6262
// CHECK: [[Y:%[0-9]+]] = zext i32 %b to i64
6363
// CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]]
@@ -108,13 +108,13 @@ long long test__readgsqword(unsigned long Offset) {
108108
__int64 test__mulh(__int64 a, __int64 b) {
109109
return __mulh(a, b);
110110
}
111-
// CHECK-X64-LABEL: define dso_local i64 @test__mulh(i64 noundef %a, i64 noundef %b)
111+
// CHECK-X64-LABEL: define dso_local range(i64 -4611686018427387904, 4611686018427387905) i64 @test__mulh(i64 noundef %a, i64 noundef %b)
112112
// CHECK-X64: = mul nsw i128 %
113113

114114
unsigned __int64 test__umulh(unsigned __int64 a, unsigned __int64 b) {
115115
return __umulh(a, b);
116116
}
117-
// CHECK-X64-LABEL: define dso_local i64 @test__umulh(i64 noundef %a, i64 noundef %b)
117+
// CHECK-X64-LABEL: define dso_local range(i64 0, -1) i64 @test__umulh(i64 noundef %a, i64 noundef %b)
118118
// CHECK-X64: = mul nuw i128 %
119119

120120
__int64 test_mul128(__int64 Multiplier,

clang/test/CodeGen/attr-counted-by.c

Lines changed: 36 additions & 36 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/ms-mixed-ptr-sizes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void test_other(struct Foo *f, __attribute__((address_space(10))) int *i) {
4949
}
5050

5151
int test_compare1(int *__ptr32 __uptr i, int *__ptr64 j) {
52-
// ALL-LABEL: define dso_local noundef i32 @test_compare1
52+
// ALL-LABEL: define dso_local range(i32 0, 2) i32 @test_compare1
5353
// X64: %{{.+}} = addrspacecast ptr %j to ptr addrspace(271)
5454
// X64: %cmp = icmp eq ptr addrspace(271) %{{.+}}, %i
5555
// X86: %{{.+}} = addrspacecast ptr addrspace(272) %j to ptr addrspace(271)
@@ -58,7 +58,7 @@ int test_compare1(int *__ptr32 __uptr i, int *__ptr64 j) {
5858
}
5959

6060
int test_compare2(int *__ptr32 __sptr i, int *__ptr64 j) {
61-
// ALL-LABEL: define dso_local noundef i32 @test_compare2
61+
// ALL-LABEL: define dso_local range(i32 0, 2) i32 @test_compare2
6262
// X64: %{{.+}} = addrspacecast ptr %j to ptr addrspace(270)
6363
// X64: %cmp = icmp eq ptr addrspace(270) %{{.+}}, %i
6464
// X86: %{{.+}} = addrspacecast ptr addrspace(272) %j to ptr
@@ -67,7 +67,7 @@ int test_compare2(int *__ptr32 __sptr i, int *__ptr64 j) {
6767
}
6868

6969
int test_compare3(int *__ptr32 __uptr i, int *__ptr64 j) {
70-
// ALL-LABEL: define dso_local noundef i32 @test_compare3
70+
// ALL-LABEL: define dso_local range(i32 0, 2) i32 @test_compare3
7171
// X64: %{{.+}} = addrspacecast ptr addrspace(271) %i to ptr
7272
// X64: %cmp = icmp eq ptr %{{.+}}, %j
7373
// X86: %{{.+}} = addrspacecast ptr addrspace(271) %i to ptr addrspace(272)
@@ -76,7 +76,7 @@ int test_compare3(int *__ptr32 __uptr i, int *__ptr64 j) {
7676
}
7777

7878
int test_compare4(int *__ptr32 __sptr i, int *__ptr64 j) {
79-
// ALL-LABEL: define dso_local noundef i32 @test_compare4
79+
// ALL-LABEL: define dso_local range(i32 0, 2) i32 @test_compare4
8080
// X64: %{{.+}} = addrspacecast ptr addrspace(270) %i to ptr
8181
// X64: %cmp = icmp eq ptr %{{.+}}, %j
8282
// X86: %{{.+}} = addrspacecast ptr %i to ptr addrspace(272)

llvm/include/llvm/IR/Function.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef unsigned ID;
4646

4747
class AssemblyAnnotationWriter;
4848
class Constant;
49+
class ConstantRange;
4950
struct DenormalMode;
5051
class DISubprogram;
5152
enum LibFunc : unsigned;
@@ -462,6 +463,9 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
462463
/// attributes for the given arg.
463464
void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes);
464465

466+
/// adds the range attribute to the list of attributes for the return value.
467+
void addRangeRetAttr(const ConstantRange &CR);
468+
465469
MaybeAlign getParamAlign(unsigned ArgNo) const {
466470
return AttributeSets.getParamAlignment(ArgNo);
467471
}

llvm/lib/IR/Function.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,10 @@ void Function::addDereferenceableOrNullParamAttr(unsigned ArgNo,
735735
ArgNo, Bytes);
736736
}
737737

738+
void Function::addRangeRetAttr(const ConstantRange &CR) {
739+
AttributeSets = AttributeSets.addRangeRetAttr(getContext(), CR);
740+
}
741+
738742
DenormalMode Function::getDenormalMode(const fltSemantics &FPType) const {
739743
if (&FPType == &APFloat::IEEEsingle()) {
740744
DenormalMode Mode = getDenormalModeF32Raw();

llvm/lib/Transforms/IPO/SCCP.cpp

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -281,32 +281,21 @@ static bool runIPSCCP(
281281
Function *F = I.first;
282282
const ValueLatticeElement &ReturnValue = I.second;
283283

284-
// If there is a known constant range for the return value, add !range
285-
// metadata to the function's call sites.
284+
// If there is a known constant range for the return value, add range
285+
// attribute to the return value.
286286
if (ReturnValue.isConstantRange() &&
287287
!ReturnValue.getConstantRange().isSingleElement()) {
288288
// Do not add range metadata if the return value may include undef.
289289
if (ReturnValue.isConstantRangeIncludingUndef())
290290
continue;
291291

292+
// Do not touch existing attribute for now.
293+
// TODO: We should be able to take the intersection of the existing
294+
// attribute and the inferred range.
295+
if (F->hasRetAttribute(Attribute::Range))
296+
continue;
292297
auto &CR = ReturnValue.getConstantRange();
293-
for (User *User : F->users()) {
294-
auto *CB = dyn_cast<CallBase>(User);
295-
if (!CB || CB->getCalledFunction() != F)
296-
continue;
297-
298-
// Do not touch existing metadata for now.
299-
// TODO: We should be able to take the intersection of the existing
300-
// metadata and the inferred range.
301-
if (CB->getMetadata(LLVMContext::MD_range))
302-
continue;
303-
304-
LLVMContext &Context = CB->getParent()->getContext();
305-
Metadata *RangeMD[] = {
306-
ConstantAsMetadata::get(ConstantInt::get(Context, CR.getLower())),
307-
ConstantAsMetadata::get(ConstantInt::get(Context, CR.getUpper()))};
308-
CB->setMetadata(LLVMContext::MD_range, MDNode::get(Context, RangeMD));
309-
}
298+
F->addRangeRetAttr(CR);
310299
continue;
311300
}
312301
if (F->getReturnType()->isVoidTy())

llvm/test/Transforms/FunctionSpecialization/discover-transitive-phis.ll

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
22
;
33
; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=20 -funcspec-for-literal-constant -S < %s | FileCheck %s --check-prefix=FUNCSPEC
44
; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=20 -funcspec-for-literal-constant -funcspec-max-discovery-iterations=16 -S < %s | FileCheck %s --check-prefix=NOFUNCSPEC
55

66
define i64 @bar(i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5, i1 %c6, i1 %c7, i1 %c8, i1 %c9, i1 %c10) {
7-
; FUNCSPEC-LABEL: define i64 @bar(
7+
; FUNCSPEC-LABEL: define range(i64 4, 13) i64 @bar(
88
; FUNCSPEC-SAME: i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
99
; FUNCSPEC-NEXT: entry:
10-
; FUNCSPEC-NEXT: [[F1:%.*]] = call i64 @foo.specialized.1(i64 3, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]]), !range [[RNG0:![0-9]+]]
11-
; FUNCSPEC-NEXT: [[F2:%.*]] = call i64 @foo.specialized.2(i64 4, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]]), !range [[RNG1:![0-9]+]]
10+
; FUNCSPEC-NEXT: [[F1:%.*]] = call i64 @foo.specialized.1(i64 3, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]])
11+
; FUNCSPEC-NEXT: [[F2:%.*]] = call i64 @foo.specialized.2(i64 4, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]])
1212
; FUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[F1]], [[F2]]
1313
; FUNCSPEC-NEXT: ret i64 [[ADD]]
1414
;
15-
; NOFUNCSPEC-LABEL: define i64 @bar(
15+
; NOFUNCSPEC-LABEL: define range(i64 4, 13) i64 @bar(
1616
; NOFUNCSPEC-SAME: i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
1717
; NOFUNCSPEC-NEXT: entry:
18-
; NOFUNCSPEC-NEXT: [[F1:%.*]] = call i64 @foo(i64 3, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]]), !range [[RNG0:![0-9]+]]
19-
; NOFUNCSPEC-NEXT: [[F2:%.*]] = call i64 @foo(i64 4, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]]), !range [[RNG0]]
18+
; NOFUNCSPEC-NEXT: [[F1:%.*]] = call i64 @foo(i64 3, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]])
19+
; NOFUNCSPEC-NEXT: [[F2:%.*]] = call i64 @foo(i64 4, i1 [[C1]], i1 [[C2]], i1 [[C3]], i1 [[C4]], i1 [[C5]], i1 [[C6]], i1 [[C7]], i1 [[C8]], i1 [[C9]], i1 [[C10]])
2020
; NOFUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[F1]], [[F2]]
2121
; NOFUNCSPEC-NEXT: ret i64 [[ADD]]
2222
;
@@ -28,6 +28,50 @@ entry:
2828
}
2929

3030
define internal i64 @foo(i64 %n, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5, i1 %c6, i1 %c7, i1 %c8, i1 %c9, i1 %c10) {
31+
; NOFUNCSPEC-LABEL: define internal range(i64 2, 7) i64 @foo(
32+
; NOFUNCSPEC-SAME: i64 [[N:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
33+
; NOFUNCSPEC-NEXT: entry:
34+
; NOFUNCSPEC-NEXT: br i1 [[C1]], label [[L1:%.*]], label [[L9:%.*]]
35+
; NOFUNCSPEC: l1:
36+
; NOFUNCSPEC-NEXT: [[PHI1:%.*]] = phi i64 [ [[N]], [[ENTRY:%.*]] ], [ [[PHI2:%.*]], [[L2:%.*]] ]
37+
; NOFUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[PHI1]], 1
38+
; NOFUNCSPEC-NEXT: br i1 [[C2]], label [[L1_5:%.*]], label [[EXIT:%.*]]
39+
; NOFUNCSPEC: l1_5:
40+
; NOFUNCSPEC-NEXT: br i1 [[C3]], label [[L1_75:%.*]], label [[L6:%.*]]
41+
; NOFUNCSPEC: l1_75:
42+
; NOFUNCSPEC-NEXT: br i1 [[C4]], label [[L2]], label [[L3:%.*]]
43+
; NOFUNCSPEC: l2:
44+
; NOFUNCSPEC-NEXT: [[PHI2]] = phi i64 [ [[PHI1]], [[L1_75]] ], [ [[PHI3:%.*]], [[L3]] ]
45+
; NOFUNCSPEC-NEXT: br label [[L1]]
46+
; NOFUNCSPEC: l3:
47+
; NOFUNCSPEC-NEXT: [[PHI3]] = phi i64 [ [[PHI1]], [[L1_75]] ], [ [[PHI4:%.*]], [[L4:%.*]] ]
48+
; NOFUNCSPEC-NEXT: br label [[L2]]
49+
; NOFUNCSPEC: l4:
50+
; NOFUNCSPEC-NEXT: [[PHI4]] = phi i64 [ [[PHI5:%.*]], [[L5:%.*]] ], [ [[PHI6:%.*]], [[L6]] ]
51+
; NOFUNCSPEC-NEXT: br i1 [[C5]], label [[L3]], label [[L6]]
52+
; NOFUNCSPEC: l5:
53+
; NOFUNCSPEC-NEXT: [[PHI5]] = phi i64 [ [[PHI6]], [[L6_5:%.*]] ], [ [[PHI7:%.*]], [[L7:%.*]] ]
54+
; NOFUNCSPEC-NEXT: br label [[L4]]
55+
; NOFUNCSPEC: l6:
56+
; NOFUNCSPEC-NEXT: [[PHI6]] = phi i64 [ [[PHI4]], [[L4]] ], [ [[PHI1]], [[L1_5]] ]
57+
; NOFUNCSPEC-NEXT: br i1 [[C6]], label [[L4]], label [[L6_5]]
58+
; NOFUNCSPEC: l6_5:
59+
; NOFUNCSPEC-NEXT: br i1 [[C7]], label [[L5]], label [[L8:%.*]]
60+
; NOFUNCSPEC: l7:
61+
; NOFUNCSPEC-NEXT: [[PHI7]] = phi i64 [ [[PHI9:%.*]], [[L9]] ], [ [[PHI8:%.*]], [[L8]] ]
62+
; NOFUNCSPEC-NEXT: br i1 [[C8]], label [[L5]], label [[L8]]
63+
; NOFUNCSPEC: l8:
64+
; NOFUNCSPEC-NEXT: [[PHI8]] = phi i64 [ [[PHI6]], [[L6_5]] ], [ [[PHI7]], [[L7]] ]
65+
; NOFUNCSPEC-NEXT: br i1 [[C9]], label [[L7]], label [[L9]]
66+
; NOFUNCSPEC: l9:
67+
; NOFUNCSPEC-NEXT: [[PHI9]] = phi i64 [ [[N]], [[ENTRY]] ], [ [[PHI8]], [[L8]] ]
68+
; NOFUNCSPEC-NEXT: [[SUB:%.*]] = sub nuw nsw i64 [[PHI9]], 1
69+
; NOFUNCSPEC-NEXT: [[MUL:%.*]] = mul nuw nsw i64 [[SUB]], 2
70+
; NOFUNCSPEC-NEXT: br i1 [[C10]], label [[L7]], label [[EXIT]]
71+
; NOFUNCSPEC: exit:
72+
; NOFUNCSPEC-NEXT: [[RES:%.*]] = phi i64 [ 2, [[L1]] ], [ [[MUL]], [[L9]] ]
73+
; NOFUNCSPEC-NEXT: ret i64 [[RES]]
74+
;
3175
entry:
3276
br i1 %c1, label %l1, label %l9
3377

llvm/test/Transforms/FunctionSpecialization/global-var-constants.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ entry:
4949
; Check if specialisation on the address of a non-const global variable
5050
; is not allowed, then it is not performed.
5151

52-
; NO-GLOBALS-LABEL: define internal i32 @g()
52+
; NO-GLOBALS-LABEL: define internal range(i32 -2147483646, -2147483648) i32 @g()
5353
; NO-GLOBALS: call i32 @f(ptr @G)
5454

55-
; NO-GLOBALS-LABEL: define i32 @h0(ptr %p)
55+
; NO-GLOBALS-LABEL: define range(i32 -2147483646, -2147483648) i32 @h0(ptr %p)
5656
; NO-GLOBALS:call i32 @g()
5757

5858
; NO-GLOBALS-LABEL: define i32 @h1()
@@ -64,10 +64,10 @@ entry:
6464
; Check if specialisation on the address of a non-const global variable
6565
; is allowed, then it is performed where possible.
6666

67-
; GLOBALS-LABEL: define internal i32 @g()
67+
; GLOBALS-LABEL: define internal range(i32 -2147483646, -2147483648) i32 @g()
6868
; GLOBALS: call i32 @f.specialized.2()
6969

70-
; GLOBALS-LABEL: define i32 @h0(ptr %p)
70+
; GLOBALS-LABEL: define range(i32 -2147483646, -2147483648) i32 @h0(ptr %p)
7171
; GLOBALS: call i32 @g()
7272

7373
; GLOBALS-LABEL: define i32 @h1()

llvm/test/Transforms/FunctionSpecialization/literal-const.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ entry:
7171
; CHECK-LIT-LABEL: define i32 @f1
7272
; CHECK-LIT: call i32 @neg.specialized.[[#B:]]
7373

74-
; CHECK-LIT-LABEL: define i32 @g0
74+
; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g0
7575
; CHECK-LIT: call i32 @add.specialized.[[#C:]]
7676

77-
; CHECK-LIT-LABEL: define i32 @g1
77+
; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g1
7878
; CHECK-LIT: call i32 @add.specialized.[[#D:]]
7979

8080
; CHECK-LIT-LABEL: define float @h0

llvm/test/Transforms/LowerTypeTests/cfi-nounwind-direct-call.ll

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ attributes #6 = { noreturn nounwind }
109109
!11 = !{}
110110
!12 = !{!"branch_weights", i32 1048575, i32 1}
111111
; CHECK: Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize willreturn memory(none)
112-
; CHECK-LABEL: define dso_local noundef i32 @_Z9nothrow_ei
113-
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) #[[ATTR0:[0-9]+]] !type !4 !type !5 !type !6 {
112+
; CHECK-LABEL: define dso_local noundef range(i32 0, 2) i32 @_Z9nothrow_ei
113+
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) #[[ATTR0:[0-9]+]] !type [[META4:![0-9]+]] !type [[META5:![0-9]+]] !type [[META6:![0-9]+]] {
114114
; CHECK-NEXT: entry:
115115
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp ne i32 [[NUM]], 0
116116
; CHECK-NEXT: [[DOT:%.*]] = zext i1 [[TOBOOL_NOT]] to i32
117117
; CHECK-NEXT: ret i32 [[DOT]]
118118
;
119119
;
120120
; CHECK: Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize willreturn memory(write, argmem: none, inaccessiblemem: none)
121-
; CHECK-LABEL: define dso_local noundef i32 @_Z10call_catchi
122-
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !type !4 !type !5 !type !6 {
121+
; CHECK-LABEL: define dso_local noundef range(i32 0, 2) i32 @_Z10call_catchi
122+
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !type [[META4]] !type [[META5]] !type [[META6]] {
123123
; CHECK-NEXT: entry:
124124
; CHECK-NEXT: store ptr @_Z9nothrow_ei.cfi_jt, ptr @catch_ptr, align 8, !tbaa [[TBAA7:![0-9]+]]
125125
; CHECK-NEXT: [[TOBOOL_NOT_I:%.*]] = icmp ne i32 [[NUM]], 0
@@ -131,17 +131,17 @@ attributes #6 = { noreturn nounwind }
131131
; CHECK-LABEL: define weak_odr hidden void @__cfi_check_fail
132132
; CHECK-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
133133
; CHECK-NEXT: entry:
134-
; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[TMP0]], null, !nosanitize !11
135-
; CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !nosanitize !11
134+
; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[TMP0]], null, !nosanitize [[META11:![0-9]+]]
135+
; CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !nosanitize [[META11]]
136136
; CHECK: trap:
137-
; CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR5:[0-9]+]], !nosanitize !11
138-
; CHECK-NEXT: unreachable, !nosanitize !11
137+
; CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR6:[0-9]+]], !nosanitize [[META11]]
138+
; CHECK-NEXT: unreachable, !nosanitize [[META11]]
139139
; CHECK: cont:
140-
; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP0]], align 4, !nosanitize !11
140+
; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP0]], align 4, !nosanitize [[META11]]
141141
; CHECK-NEXT: [[SWITCH:%.*]] = icmp ult i8 [[TMP2]], 5
142142
; CHECK-NEXT: br i1 [[SWITCH]], label [[TRAP]], label [[CONT6:%.*]]
143143
; CHECK: cont6:
144-
; CHECK-NEXT: ret void, !nosanitize !11
144+
; CHECK-NEXT: ret void, !nosanitize [[META11]]
145145
;
146146
;
147147
; CHECK-LABEL: define weak void @__cfi_check
@@ -153,8 +153,8 @@ attributes #6 = { noreturn nounwind }
153153
;
154154
; CHECK: Function Attrs: naked nocf_check noinline nounwind
155155
; CHECK-LABEL: define internal void @_Z9nothrow_ei.cfi_jt
156-
; CHECK-SAME: () #[[ATTR4:[0-9]+]] align 8 {
156+
; CHECK-SAME: () #[[ATTR5:[0-9]+]] align 8 {
157157
; CHECK-NEXT: entry:
158-
; CHECK-NEXT: tail call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr nonnull @_Z9nothrow_ei) #[[ATTR6:[0-9]+]]
158+
; CHECK-NEXT: tail call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr nonnull @_Z9nothrow_ei) #[[ATTR7:[0-9]+]]
159159
; CHECK-NEXT: unreachable
160160
;

llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target triple = "aarch64"
77
; Check that the function gets vectorized.
88

99
define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) {
10-
; CHECK-LABEL: define i32 @quant_4x4
10+
; CHECK-LABEL: define range(i32 0, 2) i32 @quant_4x4
1111
; CHECK-SAME: (ptr nocapture noundef [[DCT:%.*]], ptr nocapture noundef readonly [[MF:%.*]], ptr nocapture noundef readonly [[BIAS:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
1212
; CHECK-NEXT: entry:
1313
; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[DCT]], i64 32

llvm/test/Transforms/PhaseOrdering/icmp-ashr-breaking-select-idiom.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; RUN: opt -O1 -S < %s | FileCheck %s
33

44
define i32 @testa(i32 %mul) {
5-
; CHECK-LABEL: define i32 @testa(
5+
; CHECK-LABEL: define range(i32 -65536, 65536) i32 @testa(
66
; CHECK-SAME: i32 [[MUL:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
77
; CHECK-NEXT: [[SHR:%.*]] = ashr i32 [[MUL]], 15
88
; CHECK-NEXT: [[SPEC_SELECT_I:%.*]] = tail call i32 @llvm.smin.i32(i32 [[SHR]], i32 32767)
@@ -16,7 +16,7 @@ define i32 @testa(i32 %mul) {
1616
}
1717

1818
define i32 @testb(i32 %mul) {
19-
; CHECK-LABEL: define i32 @testb(
19+
; CHECK-LABEL: define range(i32 -16777216, 16777216) i32 @testb(
2020
; CHECK-SAME: i32 [[MUL:%.*]]) local_unnamed_addr #[[ATTR0]] {
2121
; CHECK-NEXT: [[SHR102:%.*]] = ashr i32 [[MUL]], 7
2222
; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @llvm.smax.i32(i32 [[SHR102]], i32 -128)

llvm/test/Transforms/PhaseOrdering/min_max_loop.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
;; }
2020

2121
define i16 @vecreduce_smin_v2i16(i32 %n, ptr %v) {
22-
; CHECK-LABEL: define i16 @vecreduce_smin_v2i16(
22+
; CHECK-LABEL: define range(i16 -32768, 1) i16 @vecreduce_smin_v2i16(
2323
; CHECK: @llvm.smin.v2i16
2424

2525
entry:
@@ -65,7 +65,7 @@ for.end: ; preds = %for.cond
6565
}
6666

6767
define i16 @vecreduce_smax_v2i16(i32 %n, ptr %v) {
68-
; CHECK-LABEL: define i16 @vecreduce_smax_v2i16(
68+
; CHECK-LABEL: define range(i16 0, -32768) i16 @vecreduce_smax_v2i16(
6969
; CHECK: @llvm.smax.v2i16
7070

7171
entry:

llvm/test/Transforms/SCCP/and-add-shl.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ define i8 @and_not_shl_1(i8 %x) {
5959

6060
; Negative test: https://alive2.llvm.org/ce/z/Zv4Pyu
6161
define i8 @and_add_shl_overlap(i8 %x) {
62-
; CHECK-LABEL: define i8 @and_add_shl_overlap
62+
; CHECK-LABEL: define range(i8 0, 33) i8 @and_add_shl_overlap
6363
; CHECK-SAME: (i8 [[X:%.*]]) {
6464
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ule i8 [[X]], 6
6565
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])
@@ -77,7 +77,7 @@ define i8 @and_add_shl_overlap(i8 %x) {
7777
}
7878

7979
define i8 @and_not_shl_overlap(i8 %x) {
80-
; CHECK-LABEL: define i8 @and_not_shl_overlap
80+
; CHECK-LABEL: define range(i8 0, 5) i8 @and_not_shl_overlap
8181
; CHECK-SAME: (i8 [[X:%.*]]) {
8282
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ule i8 [[X]], 3
8383
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])

0 commit comments

Comments
 (0)