diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 891e6b09d26e3..6fc47c73d60f5 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -4347,8 +4347,18 @@ struct AAIsDeadFunction : public AAIsDead { indicatePessimisticFixpoint(); return; } - ToBeExploredFrom.insert(&F->getEntryBlock().front()); - assumeLive(A, F->getEntryBlock()); + if (!isAssumedDeadInternalFunction(A)) { + ToBeExploredFrom.insert(&F->getEntryBlock().front()); + assumeLive(A, F->getEntryBlock()); + } + } + + bool isAssumedDeadInternalFunction(Attributor &A) { + if (!getAnchorScope()->hasLocalLinkage()) + return false; + bool UsedAssumedInformation = false; + return A.checkForAllCallSites([](AbstractCallSite) { return false; }, *this, + true, UsedAssumedInformation); } /// See AbstractAttribute::getAsStr(). @@ -4596,6 +4606,16 @@ identifyAliveSuccessors(Attributor &A, const SwitchInst &SI, ChangeStatus AAIsDeadFunction::updateImpl(Attributor &A) { ChangeStatus Change = ChangeStatus::UNCHANGED; + if (AssumedLiveBlocks.empty()) { + if (isAssumedDeadInternalFunction(A)) + return ChangeStatus::UNCHANGED; + + Function *F = getAnchorScope(); + ToBeExploredFrom.insert(&F->getEntryBlock().front()); + assumeLive(A, F->getEntryBlock()); + Change = ChangeStatus::CHANGED; + } + LLVM_DEBUG(dbgs() << "[AAIsDead] Live [" << AssumedLiveBlocks.size() << "/" << getAnchorScope()->size() << "] BBs and " << ToBeExploredFrom.size() << " exploration points and " diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll index 0dda2d748e07d..ad50e72421827 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead.ll @@ -5,7 +5,7 @@ define internal void @dead() { ; CGSCC-LABEL: define {{[^@]+}}@dead() { -; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @test(ptr noalias noundef align 4294967296 null) +; CGSCC-NEXT: [[TMP1:%.*]] = call i32 poison(ptr null, ptr null) ; CGSCC-NEXT: ret void ; call i32 @test(ptr null, ptr null) @@ -13,12 +13,11 @@ define internal void @dead() { } define internal i32 @test(ptr %X, ptr %Y) { -; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write) +; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none) ; CGSCC-LABEL: define {{[^@]+}}@test -; CGSCC-SAME: (ptr noalias nocapture nofree noundef writeonly align 4 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; CGSCC-SAME: () #[[ATTR0:[0-9]+]] { ; CGSCC-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]] ; CGSCC: live: -; CGSCC-NEXT: store i32 0, ptr [[X]], align 4 ; CGSCC-NEXT: ret i32 undef ; CGSCC: dead: ; CGSCC-NEXT: unreachable @@ -36,9 +35,8 @@ dead: define internal i32 @caller(ptr %B) { ; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(none) ; CGSCC-LABEL: define {{[^@]+}}@caller -; CGSCC-SAME: () #[[ATTR1:[0-9]+]] { +; CGSCC-SAME: () #[[ATTR0]] { ; CGSCC-NEXT: [[A:%.*]] = alloca i32, align 4 -; CGSCC-NEXT: [[C:%.*]] = call i32 @test(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR3:[0-9]+]] ; CGSCC-NEXT: ret i32 0 ; %A = alloca i32 @@ -56,9 +54,9 @@ define i32 @callercaller() { ; ; CGSCC: Function Attrs: nofree nosync nounwind willreturn memory(none) ; CGSCC-LABEL: define {{[^@]+}}@callercaller -; CGSCC-SAME: () #[[ATTR2:[0-9]+]] { +; CGSCC-SAME: () #[[ATTR1:[0-9]+]] { ; CGSCC-NEXT: [[B:%.*]] = alloca i32, align 4 -; CGSCC-NEXT: [[X:%.*]] = call noundef i32 @caller() #[[ATTR4:[0-9]+]] +; CGSCC-NEXT: [[X:%.*]] = call noundef i32 @caller() #[[ATTR2:[0-9]+]] ; CGSCC-NEXT: ret i32 [[X]] ; %B = alloca i32 @@ -70,11 +68,9 @@ define i32 @callercaller() { ;. ; TUNIT: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn memory(none) } ;. -; CGSCC: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn memory(argmem: write) } -; CGSCC: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind willreturn memory(none) } -; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(none) } -; CGSCC: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn memory(write) } -; CGSCC: attributes #[[ATTR4]] = { willreturn } +; CGSCC: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn memory(none) } +; CGSCC: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(none) } +; CGSCC: attributes #[[ATTR2]] = { willreturn } ;. ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: ; CHECK: {{.*}} diff --git a/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll b/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll index a5be8effece8f..a53ce5bed76df 100644 --- a/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll +++ b/llvm/test/Transforms/Attributor/ArgumentPromotion/live_called_from_dead_2.ll @@ -5,7 +5,7 @@ define internal void @dead() { ; CGSCC-LABEL: define {{[^@]+}}@dead() { -; CGSCC-NEXT: [[TMP1:%.*]] = call i32 @test(ptr noalias noundef align 4294967296 null) +; CGSCC-NEXT: [[TMP1:%.*]] = call i32 poison(ptr null, ptr null) ; CGSCC-NEXT: ret void ; call i32 @test(ptr null, ptr null) @@ -13,15 +13,24 @@ define internal void @dead() { } define internal i32 @test(ptr %X, ptr %Y) { -; CHECK: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write) -; CHECK-LABEL: define {{[^@]+}}@test -; CHECK-SAME: (ptr noalias nocapture nofree noundef writeonly align 4 [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; CHECK-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]] -; CHECK: live: -; CHECK-NEXT: store i32 0, ptr [[X]], align 4 -; CHECK-NEXT: ret i32 undef -; CHECK: dead: -; CHECK-NEXT: unreachable +; TUNIT: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write) +; TUNIT-LABEL: define {{[^@]+}}@test +; TUNIT-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; TUNIT-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]] +; TUNIT: live: +; TUNIT-NEXT: ret i32 undef +; TUNIT: dead: +; TUNIT-NEXT: unreachable +; +; CGSCC: Function Attrs: nofree norecurse nosync nounwind willreturn memory(argmem: write) +; CGSCC-LABEL: define {{[^@]+}}@test +; CGSCC-SAME: (ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; CGSCC-NEXT: br i1 true, label [[LIVE:%.*]], label [[DEAD:%.*]] +; CGSCC: live: +; CGSCC-NEXT: store i32 0, ptr [[X]], align 4 +; CGSCC-NEXT: ret i32 undef +; CGSCC: dead: +; CGSCC-NEXT: unreachable ; br i1 true, label %live, label %dead live: @@ -86,3 +95,5 @@ define i32 @callercaller() { ; CGSCC: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(write) } ; CGSCC: attributes #[[ATTR3]] = { nounwind willreturn } ;. +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; CHECK: {{.*}} diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll b/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll index d8c55ab418120..9bf88b122be5f 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/2009-09-24-byval-ptr.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC ; Don't constant-propagate byval pointers, since they are not pointers! diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll b/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll index 49a3dd40ddf6c..288e316c34df8 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/multiple_callbacks.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC ; ; diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll index f353517571850..63a9f23f3db60 100644 --- a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll +++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=9 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC ;; FIXME: support for extractvalue and insertvalue missing. diff --git a/llvm/test/Transforms/Attributor/align.ll b/llvm/test/Transforms/Attributor/align.ll index 7f548413d0549..58b24f51f5d47 100644 --- a/llvm/test/Transforms/Attributor/align.ll +++ b/llvm/test/Transforms/Attributor/align.ll @@ -261,13 +261,17 @@ define internal ptr @f2b(ptr readnone %0) local_unnamed_addr #0 { ; CGSCC: Function Attrs: noinline nounwind uwtable ; CGSCC-LABEL: define {{[^@]+}}@f2b ; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] { -; CGSCC-NEXT: unreachable -; CGSCC: 2: -; CGSCC-NEXT: unreachable +; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null +; CGSCC-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]] ; CGSCC: 3: -; CGSCC-NEXT: unreachable -; CGSCC: 4: -; CGSCC-NEXT: unreachable +; CGSCC-NEXT: [[TMP4:%.*]] = tail call ptr poison(ptr nonnull [[TMP0]]) +; CGSCC-NEXT: br label [[TMP7:%.*]] +; CGSCC: 5: +; CGSCC-NEXT: [[TMP6:%.*]] = tail call ptr @f3b() +; CGSCC-NEXT: br label [[TMP7]] +; CGSCC: 7: +; CGSCC-NEXT: [[TMP8:%.*]] = phi ptr [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ] +; CGSCC-NEXT: ret ptr [[TMP8]] ; %2 = icmp eq i8* %0, null br i1 %2, label %5, label %3 @@ -289,14 +293,14 @@ define internal ptr @f2b(ptr readnone %0) local_unnamed_addr #0 { ; Function Attrs: nounwind readnone ssp uwtable define internal ptr @f3b(ptr readnone %0) local_unnamed_addr #0 { ; -; CGSCC: Function Attrs: noinline nounwind uwtable +; CGSCC: Function Attrs: nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable ; CGSCC-LABEL: define {{[^@]+}}@f3b -; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] { +; CGSCC-SAME: () local_unnamed_addr #[[ATTR0]] { +; CGSCC-NEXT: br label [[TMP2:%.*]] +; CGSCC: 1: ; CGSCC-NEXT: unreachable ; CGSCC: 2: -; CGSCC-NEXT: unreachable -; CGSCC: 3: -; CGSCC-NEXT: unreachable +; CGSCC-NEXT: ret ptr @a1 ; %2 = icmp eq i8* %0, null br i1 %2, label %3, label %5 diff --git a/llvm/test/Transforms/Attributor/internal-noalias.ll b/llvm/test/Transforms/Attributor/internal-noalias.ll index 29d3f27fa5d3e..b44446482cc21 100644 --- a/llvm/test/Transforms/Attributor/internal-noalias.ll +++ b/llvm/test/Transforms/Attributor/internal-noalias.ll @@ -5,7 +5,7 @@ define dso_local i32 @visible(ptr noalias %A, ptr noalias %B) #0 { ; TUNIT: Function Attrs: nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable ; TUNIT-LABEL: define {{[^@]+}}@visible -; TUNIT-SAME: (ptr noalias nocapture nofree readonly [[A:%.*]], ptr noalias nocapture nofree readonly align 4 [[B:%.*]]) #[[ATTR0:[0-9]+]] { +; TUNIT-SAME: (ptr noalias nocapture nofree readonly [[A:%.*]], ptr noalias nocapture nofree readonly [[B:%.*]]) #[[ATTR0:[0-9]+]] { ; TUNIT-NEXT: entry: ; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @noalias_args(ptr noalias nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR4:[0-9]+]] ; TUNIT-NEXT: [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr noalias nocapture nofree readonly align 4 [[A]], ptr noalias nocapture nofree readonly align 4 [[B]]) #[[ATTR4]] diff --git a/llvm/test/Transforms/Attributor/memory_locations.ll b/llvm/test/Transforms/Attributor/memory_locations.ll index d25aa7fd2135d..49de7a9858346 100644 --- a/llvm/test/Transforms/Attributor/memory_locations.ll +++ b/llvm/test/Transforms/Attributor/memory_locations.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" diff --git a/llvm/test/Transforms/Attributor/misc.ll b/llvm/test/Transforms/Attributor/misc.ll index 0c410e1d20e66..7ec85cf8d87e2 100644 --- a/llvm/test/Transforms/Attributor/misc.ll +++ b/llvm/test/Transforms/Attributor/misc.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=3 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC ; ; Mostly check we do not crash on these uses diff --git a/llvm/test/Transforms/Attributor/nonnull.ll b/llvm/test/Transforms/Attributor/nonnull.ll index 0dfd4554a9909..4ee391a136ee7 100644 --- a/llvm/test/Transforms/Attributor/nonnull.ll +++ b/llvm/test/Transforms/Attributor/nonnull.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=19 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC diff --git a/llvm/test/Transforms/Attributor/value-simplify-gpu.ll b/llvm/test/Transforms/Attributor/value-simplify-gpu.ll index f8b96c5dbfdfb..2c10b64d364bd 100644 --- a/llvm/test/Transforms/Attributor/value-simplify-gpu.ll +++ b/llvm/test/Transforms/Attributor/value-simplify-gpu.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=9 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC target triple = "amdgcn-amd-amdhsa" @@ -21,7 +21,7 @@ define dso_local void @kernel(i32 %C) norecurse "kernel" { ; TUNIT-LABEL: define {{[^@]+}}@kernel ; TUNIT-SAME: (i32 [[C:%.*]]) #[[ATTR0:[0-9]+]] { ; TUNIT-NEXT: entry: -; TUNIT-NEXT: call void @level1Kernel(i32 [[C]]) #[[ATTR3:[0-9]+]] +; TUNIT-NEXT: call void @level1Kernel(i32 [[C]]) #[[ATTR1:[0-9]+]] ; TUNIT-NEXT: ret void ; ; CGSCC: Function Attrs: norecurse nosync nounwind @@ -39,19 +39,19 @@ entry: define internal void @level1Kernel(i32 %C) { ; TUNIT: Function Attrs: norecurse nosync nounwind ; TUNIT-LABEL: define {{[^@]+}}@level1Kernel -; TUNIT-SAME: (i32 [[C:%.*]]) #[[ATTR1:[0-9]+]] { +; TUNIT-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { ; TUNIT-NEXT: entry: -; TUNIT-NEXT: call void @level2Kernelall_early() #[[ATTR4:[0-9]+]] +; TUNIT-NEXT: call void @level2Kernelall_early() #[[ATTR3:[0-9]+]] ; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[C]], 0 ; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] ; TUNIT: if.then: -; TUNIT-NEXT: call void @level2Kernela() #[[ATTR3]] +; TUNIT-NEXT: call void @level2Kernela() #[[ATTR4:[0-9]+]] ; TUNIT-NEXT: br label [[IF_END:%.*]] ; TUNIT: if.else: -; TUNIT-NEXT: call void @level2Kernelb() #[[ATTR3]] +; TUNIT-NEXT: call void @level2Kernelb() #[[ATTR4]] ; TUNIT-NEXT: br label [[IF_END]] ; TUNIT: if.end: -; TUNIT-NEXT: call void @level2Kernelall_late() #[[ATTR3]] +; TUNIT-NEXT: call void @level2Kernelall_late() #[[ATTR4]] ; TUNIT-NEXT: ret void ; ; CGSCC: Function Attrs: norecurse nosync nounwind @@ -183,7 +183,7 @@ define dso_local void @non_kernel(i32 %C) norecurse { ; TUNIT-LABEL: define {{[^@]+}}@non_kernel ; TUNIT-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { ; TUNIT-NEXT: entry: -; TUNIT-NEXT: call void @level1(i32 [[C]]) #[[ATTR3]] +; TUNIT-NEXT: call void @level1(i32 [[C]]) #[[ATTR1]] ; TUNIT-NEXT: ret void ; ; CGSCC: Function Attrs: norecurse nosync nounwind @@ -204,17 +204,17 @@ define internal void @level1(i32 %C) { ; TUNIT-SAME: (i32 [[C:%.*]]) #[[ATTR1]] { ; TUNIT-NEXT: entry: ; TUNIT-NEXT: [[LOCAL:%.*]] = alloca i32, align 4 -; TUNIT-NEXT: call void @level2all_early(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[LOCAL]]) #[[ATTR4]] +; TUNIT-NEXT: call void @level2all_early(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[LOCAL]]) #[[ATTR3]] ; TUNIT-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[C]], 0 ; TUNIT-NEXT: br i1 [[TOBOOL]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]] ; TUNIT: if.then: -; TUNIT-NEXT: call void @level2a() #[[ATTR3]] +; TUNIT-NEXT: call void @level2a() #[[ATTR4]] ; TUNIT-NEXT: br label [[IF_END:%.*]] ; TUNIT: if.else: -; TUNIT-NEXT: call void @level2b() #[[ATTR3]] +; TUNIT-NEXT: call void @level2b() #[[ATTR4]] ; TUNIT-NEXT: br label [[IF_END]] ; TUNIT: if.end: -; TUNIT-NEXT: call void @level2all_late(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[LOCAL]]) #[[ATTR3]] +; TUNIT-NEXT: call void @level2all_late(ptr noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[LOCAL]]) #[[ATTR4]] ; TUNIT-NEXT: ret void ; ; CGSCC: Function Attrs: norecurse nosync nounwind @@ -360,8 +360,8 @@ declare dso_local void @use(i32, i32, i32) nosync norecurse nounwind ; TUNIT: attributes #[[ATTR0]] = { norecurse nosync nounwind "kernel" } ; TUNIT: attributes #[[ATTR1]] = { norecurse nosync nounwind } ; TUNIT: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind willreturn memory(write) } -; TUNIT: attributes #[[ATTR3]] = { nosync nounwind } -; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn } +; TUNIT: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn } +; TUNIT: attributes #[[ATTR4]] = { nosync nounwind } ; TUNIT: attributes #[[ATTR5]] = { nounwind } ;. ; CGSCC: attributes #[[ATTR0]] = { norecurse nosync nounwind "kernel" } diff --git a/llvm/test/Transforms/Attributor/value-simplify.ll b/llvm/test/Transforms/Attributor/value-simplify.ll index e01a8d84ed1f5..ae0e30b42f651 100644 --- a/llvm/test/Transforms/Attributor/value-simplify.ll +++ b/llvm/test/Transforms/Attributor/value-simplify.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals -; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT +; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"