Skip to content

[SCCP] Swap out range metadata to range attribute #90134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions clang/test/CodeGen/X86/ms-x86-intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ long long test__readfsqword(unsigned long Offset) {
__int64 test__emul(int a, int b) {
return __emul(a, b);
}
// CHECK-LABEL: define dso_local i64 @test__emul(i32 noundef %a, i32 noundef %b)
// CHECK-LABEL: define dso_local range(i64 -4611686016279904256, 4611686018427387905) i64 @test__emul(i32 noundef %a, i32 noundef %b)
// CHECK: [[X:%[0-9]+]] = sext i32 %a to i64
// CHECK: [[Y:%[0-9]+]] = sext i32 %b to i64
// CHECK: [[RES:%[0-9]+]] = mul nsw i64 [[Y]], [[X]]
Expand All @@ -57,7 +57,7 @@ __int64 test__emul(int a, int b) {
unsigned __int64 test__emulu(unsigned int a, unsigned int b) {
return __emulu(a, b);
}
// CHECK-LABEL: define dso_local i64 @test__emulu(i32 noundef %a, i32 noundef %b)
// CHECK-LABEL: define dso_local range(i64 0, -8589934590) i64 @test__emulu(i32 noundef %a, i32 noundef %b)
// CHECK: [[X:%[0-9]+]] = zext i32 %a to i64
// CHECK: [[Y:%[0-9]+]] = zext i32 %b to i64
// CHECK: [[RES:%[0-9]+]] = mul nuw i64 [[Y]], [[X]]
Expand Down Expand Up @@ -108,13 +108,13 @@ long long test__readgsqword(unsigned long Offset) {
__int64 test__mulh(__int64 a, __int64 b) {
return __mulh(a, b);
}
// CHECK-X64-LABEL: define dso_local i64 @test__mulh(i64 noundef %a, i64 noundef %b)
// CHECK-X64-LABEL: define dso_local range(i64 -4611686018427387904, 4611686018427387905) i64 @test__mulh(i64 noundef %a, i64 noundef %b)
// CHECK-X64: = mul nsw i128 %

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

__int64 test_mul128(__int64 Multiplier,
Expand Down
72 changes: 36 additions & 36 deletions clang/test/CodeGen/attr-counted-by.c

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions clang/test/CodeGen/ms-mixed-ptr-sizes.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void test_other(struct Foo *f, __attribute__((address_space(10))) int *i) {
}

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

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

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

int test_compare4(int *__ptr32 __sptr i, int *__ptr64 j) {
// ALL-LABEL: define dso_local noundef i32 @test_compare4
// ALL-LABEL: define dso_local range(i32 0, 2) i32 @test_compare4
// X64: %{{.+}} = addrspacecast ptr addrspace(270) %i to ptr
// X64: %cmp = icmp eq ptr %{{.+}}, %j
// X86: %{{.+}} = addrspacecast ptr %i to ptr addrspace(272)
Expand Down
4 changes: 4 additions & 0 deletions llvm/include/llvm/IR/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef unsigned ID;

class AssemblyAnnotationWriter;
class Constant;
class ConstantRange;
struct DenormalMode;
class DISubprogram;
enum LibFunc : unsigned;
Expand Down Expand Up @@ -462,6 +463,9 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
/// attributes for the given arg.
void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes);

/// adds the range attribute to the list of attributes for the return value.
void addRangeRetAttr(const ConstantRange &CR);

MaybeAlign getParamAlign(unsigned ArgNo) const {
return AttributeSets.getParamAlignment(ArgNo);
}
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/IR/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,10 @@ void Function::addDereferenceableOrNullParamAttr(unsigned ArgNo,
ArgNo, Bytes);
}

void Function::addRangeRetAttr(const ConstantRange &CR) {
AttributeSets = AttributeSets.addRangeRetAttr(getContext(), CR);
}

DenormalMode Function::getDenormalMode(const fltSemantics &FPType) const {
if (&FPType == &APFloat::IEEEsingle()) {
DenormalMode Mode = getDenormalModeF32Raw();
Expand Down
27 changes: 8 additions & 19 deletions llvm/lib/Transforms/IPO/SCCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,32 +281,21 @@ static bool runIPSCCP(
Function *F = I.first;
const ValueLatticeElement &ReturnValue = I.second;

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

// Do not touch existing attribute for now.
// TODO: We should be able to take the intersection of the existing
// attribute and the inferred range.
if (F->hasRetAttribute(Attribute::Range))
continue;
auto &CR = ReturnValue.getConstantRange();
for (User *User : F->users()) {
auto *CB = dyn_cast<CallBase>(User);
if (!CB || CB->getCalledFunction() != F)
continue;

// Do not touch existing metadata for now.
// TODO: We should be able to take the intersection of the existing
// metadata and the inferred range.
if (CB->getMetadata(LLVMContext::MD_range))
continue;

LLVMContext &Context = CB->getParent()->getContext();
Metadata *RangeMD[] = {
ConstantAsMetadata::get(ConstantInt::get(Context, CR.getLower())),
ConstantAsMetadata::get(ConstantInt::get(Context, CR.getUpper()))};
CB->setMetadata(LLVMContext::MD_range, MDNode::get(Context, RangeMD));
}
F->addRangeRetAttr(CR);
continue;
}
if (F->getReturnType()->isVoidTy())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
;
; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=20 -funcspec-for-literal-constant -S < %s | FileCheck %s --check-prefix=FUNCSPEC
; 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

define i64 @bar(i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5, i1 %c6, i1 %c7, i1 %c8, i1 %c9, i1 %c10) {
; FUNCSPEC-LABEL: define i64 @bar(
; FUNCSPEC-LABEL: define range(i64 4, 13) i64 @bar(
; FUNCSPEC-SAME: i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
; FUNCSPEC-NEXT: entry:
; 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]+]]
; 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]+]]
; 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]])
; 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]])
; FUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[F1]], [[F2]]
; FUNCSPEC-NEXT: ret i64 [[ADD]]
;
; NOFUNCSPEC-LABEL: define i64 @bar(
; NOFUNCSPEC-LABEL: define range(i64 4, 13) i64 @bar(
; NOFUNCSPEC-SAME: i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
; NOFUNCSPEC-NEXT: entry:
; 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]+]]
; 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]]
; 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]])
; 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]])
; NOFUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[F1]], [[F2]]
; NOFUNCSPEC-NEXT: ret i64 [[ADD]]
;
Expand All @@ -28,6 +28,50 @@ entry:
}

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) {
; NOFUNCSPEC-LABEL: define internal range(i64 2, 7) i64 @foo(
; NOFUNCSPEC-SAME: i64 [[N:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], i1 [[C3:%.*]], i1 [[C4:%.*]], i1 [[C5:%.*]], i1 [[C6:%.*]], i1 [[C7:%.*]], i1 [[C8:%.*]], i1 [[C9:%.*]], i1 [[C10:%.*]]) {
; NOFUNCSPEC-NEXT: entry:
; NOFUNCSPEC-NEXT: br i1 [[C1]], label [[L1:%.*]], label [[L9:%.*]]
; NOFUNCSPEC: l1:
; NOFUNCSPEC-NEXT: [[PHI1:%.*]] = phi i64 [ [[N]], [[ENTRY:%.*]] ], [ [[PHI2:%.*]], [[L2:%.*]] ]
; NOFUNCSPEC-NEXT: [[ADD:%.*]] = add nuw nsw i64 [[PHI1]], 1
; NOFUNCSPEC-NEXT: br i1 [[C2]], label [[L1_5:%.*]], label [[EXIT:%.*]]
; NOFUNCSPEC: l1_5:
; NOFUNCSPEC-NEXT: br i1 [[C3]], label [[L1_75:%.*]], label [[L6:%.*]]
; NOFUNCSPEC: l1_75:
; NOFUNCSPEC-NEXT: br i1 [[C4]], label [[L2]], label [[L3:%.*]]
; NOFUNCSPEC: l2:
; NOFUNCSPEC-NEXT: [[PHI2]] = phi i64 [ [[PHI1]], [[L1_75]] ], [ [[PHI3:%.*]], [[L3]] ]
; NOFUNCSPEC-NEXT: br label [[L1]]
; NOFUNCSPEC: l3:
; NOFUNCSPEC-NEXT: [[PHI3]] = phi i64 [ [[PHI1]], [[L1_75]] ], [ [[PHI4:%.*]], [[L4:%.*]] ]
; NOFUNCSPEC-NEXT: br label [[L2]]
; NOFUNCSPEC: l4:
; NOFUNCSPEC-NEXT: [[PHI4]] = phi i64 [ [[PHI5:%.*]], [[L5:%.*]] ], [ [[PHI6:%.*]], [[L6]] ]
; NOFUNCSPEC-NEXT: br i1 [[C5]], label [[L3]], label [[L6]]
; NOFUNCSPEC: l5:
; NOFUNCSPEC-NEXT: [[PHI5]] = phi i64 [ [[PHI6]], [[L6_5:%.*]] ], [ [[PHI7:%.*]], [[L7:%.*]] ]
; NOFUNCSPEC-NEXT: br label [[L4]]
; NOFUNCSPEC: l6:
; NOFUNCSPEC-NEXT: [[PHI6]] = phi i64 [ [[PHI4]], [[L4]] ], [ [[PHI1]], [[L1_5]] ]
; NOFUNCSPEC-NEXT: br i1 [[C6]], label [[L4]], label [[L6_5]]
; NOFUNCSPEC: l6_5:
; NOFUNCSPEC-NEXT: br i1 [[C7]], label [[L5]], label [[L8:%.*]]
; NOFUNCSPEC: l7:
; NOFUNCSPEC-NEXT: [[PHI7]] = phi i64 [ [[PHI9:%.*]], [[L9]] ], [ [[PHI8:%.*]], [[L8]] ]
; NOFUNCSPEC-NEXT: br i1 [[C8]], label [[L5]], label [[L8]]
; NOFUNCSPEC: l8:
; NOFUNCSPEC-NEXT: [[PHI8]] = phi i64 [ [[PHI6]], [[L6_5]] ], [ [[PHI7]], [[L7]] ]
; NOFUNCSPEC-NEXT: br i1 [[C9]], label [[L7]], label [[L9]]
; NOFUNCSPEC: l9:
; NOFUNCSPEC-NEXT: [[PHI9]] = phi i64 [ [[N]], [[ENTRY]] ], [ [[PHI8]], [[L8]] ]
; NOFUNCSPEC-NEXT: [[SUB:%.*]] = sub nuw nsw i64 [[PHI9]], 1
; NOFUNCSPEC-NEXT: [[MUL:%.*]] = mul nuw nsw i64 [[SUB]], 2
; NOFUNCSPEC-NEXT: br i1 [[C10]], label [[L7]], label [[EXIT]]
; NOFUNCSPEC: exit:
; NOFUNCSPEC-NEXT: [[RES:%.*]] = phi i64 [ 2, [[L1]] ], [ [[MUL]], [[L9]] ]
; NOFUNCSPEC-NEXT: ret i64 [[RES]]
;
entry:
br i1 %c1, label %l1, label %l9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ entry:
; Check if specialisation on the address of a non-const global variable
; is not allowed, then it is not performed.

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

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

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

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

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

; GLOBALS-LABEL: define i32 @h1()
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/FunctionSpecialization/literal-const.ll
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ entry:
; CHECK-LIT-LABEL: define i32 @f1
; CHECK-LIT: call i32 @neg.specialized.[[#B:]]

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

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

; CHECK-LIT-LABEL: define float @h0
Expand Down
24 changes: 12 additions & 12 deletions llvm/test/Transforms/LowerTypeTests/cfi-nounwind-direct-call.ll
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ attributes #6 = { noreturn nounwind }
!11 = !{}
!12 = !{!"branch_weights", i32 1048575, i32 1}
; CHECK: Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize willreturn memory(none)
; CHECK-LABEL: define dso_local noundef i32 @_Z9nothrow_ei
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) #[[ATTR0:[0-9]+]] !type !4 !type !5 !type !6 {
; CHECK-LABEL: define dso_local noundef range(i32 0, 2) i32 @_Z9nothrow_ei
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) #[[ATTR0:[0-9]+]] !type [[META4:![0-9]+]] !type [[META5:![0-9]+]] !type [[META6:![0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TOBOOL_NOT:%.*]] = icmp ne i32 [[NUM]], 0
; CHECK-NEXT: [[DOT:%.*]] = zext i1 [[TOBOOL_NOT]] to i32
; CHECK-NEXT: ret i32 [[DOT]]
;
;
; CHECK: Function Attrs: minsize mustprogress nofree norecurse nosync nounwind optsize willreturn memory(write, argmem: none, inaccessiblemem: none)
; CHECK-LABEL: define dso_local noundef i32 @_Z10call_catchi
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !type !4 !type !5 !type !6 {
; CHECK-LABEL: define dso_local noundef range(i32 0, 2) i32 @_Z10call_catchi
; CHECK-SAME: (i32 noundef [[NUM:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] !type [[META4]] !type [[META5]] !type [[META6]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: store ptr @_Z9nothrow_ei.cfi_jt, ptr @catch_ptr, align 8, !tbaa [[TBAA7:![0-9]+]]
; CHECK-NEXT: [[TOBOOL_NOT_I:%.*]] = icmp ne i32 [[NUM]], 0
Expand All @@ -131,17 +131,17 @@ attributes #6 = { noreturn nounwind }
; CHECK-LABEL: define weak_odr hidden void @__cfi_check_fail
; CHECK-SAME: (ptr noundef [[TMP0:%.*]], ptr noundef [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[TMP0]], null, !nosanitize !11
; CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !nosanitize !11
; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq ptr [[TMP0]], null, !nosanitize [[META11:![0-9]+]]
; CHECK-NEXT: br i1 [[DOTNOT]], label [[TRAP:%.*]], label [[CONT:%.*]], !nosanitize [[META11]]
; CHECK: trap:
; CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR5:[0-9]+]], !nosanitize !11
; CHECK-NEXT: unreachable, !nosanitize !11
; CHECK-NEXT: tail call void @llvm.ubsantrap(i8 2) #[[ATTR6:[0-9]+]], !nosanitize [[META11]]
; CHECK-NEXT: unreachable, !nosanitize [[META11]]
; CHECK: cont:
; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP0]], align 4, !nosanitize !11
; CHECK-NEXT: [[TMP2:%.*]] = load i8, ptr [[TMP0]], align 4, !nosanitize [[META11]]
; CHECK-NEXT: [[SWITCH:%.*]] = icmp ult i8 [[TMP2]], 5
; CHECK-NEXT: br i1 [[SWITCH]], label [[TRAP]], label [[CONT6:%.*]]
; CHECK: cont6:
; CHECK-NEXT: ret void, !nosanitize !11
; CHECK-NEXT: ret void, !nosanitize [[META11]]
;
;
; CHECK-LABEL: define weak void @__cfi_check
Expand All @@ -153,8 +153,8 @@ attributes #6 = { noreturn nounwind }
;
; CHECK: Function Attrs: naked nocf_check noinline nounwind
; CHECK-LABEL: define internal void @_Z9nothrow_ei.cfi_jt
; CHECK-SAME: () #[[ATTR4:[0-9]+]] align 8 {
; CHECK-SAME: () #[[ATTR5:[0-9]+]] align 8 {
; CHECK-NEXT: entry:
; CHECK-NEXT: tail call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr nonnull @_Z9nothrow_ei) #[[ATTR6:[0-9]+]]
; CHECK-NEXT: tail call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr nonnull @_Z9nothrow_ei) #[[ATTR7:[0-9]+]]
; CHECK-NEXT: unreachable
;
2 changes: 1 addition & 1 deletion llvm/test/Transforms/PhaseOrdering/AArch64/quant_4x4.ll
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target triple = "aarch64"
; Check that the function gets vectorized.

define i32 @quant_4x4(ptr noundef %dct, ptr noundef %mf, ptr noundef %bias) {
; CHECK-LABEL: define i32 @quant_4x4
; CHECK-LABEL: define range(i32 0, 2) i32 @quant_4x4
; CHECK-SAME: (ptr nocapture noundef [[DCT:%.*]], ptr nocapture noundef readonly [[MF:%.*]], ptr nocapture noundef readonly [[BIAS:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[SCEVGEP:%.*]] = getelementptr i8, ptr [[DCT]], i64 32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; RUN: opt -O1 -S < %s | FileCheck %s

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

define i32 @testb(i32 %mul) {
; CHECK-LABEL: define i32 @testb(
; CHECK-LABEL: define range(i32 -16777216, 16777216) i32 @testb(
; CHECK-SAME: i32 [[MUL:%.*]]) local_unnamed_addr #[[ATTR0]] {
; CHECK-NEXT: [[SHR102:%.*]] = ashr i32 [[MUL]], 7
; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @llvm.smax.i32(i32 [[SHR102]], i32 -128)
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/PhaseOrdering/min_max_loop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
;; }

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

entry:
Expand Down Expand Up @@ -65,7 +65,7 @@ for.end: ; preds = %for.cond
}

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

entry:
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/Transforms/SCCP/and-add-shl.ll
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define i8 @and_not_shl_1(i8 %x) {

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

define i8 @and_not_shl_overlap(i8 %x) {
; CHECK-LABEL: define i8 @and_not_shl_overlap
; CHECK-LABEL: define range(i8 0, 5) i8 @and_not_shl_overlap
; CHECK-SAME: (i8 [[X:%.*]]) {
; CHECK-NEXT: [[OP1_P2:%.*]] = icmp ule i8 [[X]], 3
; CHECK-NEXT: call void @llvm.assume(i1 [[OP1_P2]])
Expand Down
Loading