<div dir="ltr">asan is still broken <a href="https://lab.llvm.org/buildbot/#/builders/5/builds/25088" target="_blank">https://lab.llvm.org/buildbot/#/builders/5/builds/25088</a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 21 Jun 2022 at 19:31, Johannes Doerfert via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Johannes Doerfert<br>
Date: 2022-06-21T21:28:26-05:00<br>
New Revision: 083010312aa4a0ba0cd5299bd3b039af8fb6d58f<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/083010312aa4a0ba0cd5299bd3b039af8fb6d58f.diff</a><br>
<br>
LOG: [Attributor] Ensure to use the proper liveness AA<br>
<br>
When determining liveness via Attributor::isAssumedDead(...) we might<br>
end up without a liveness AA or with one pointing into another function.<br>
Neither is helpful and we will avoid both from now on.<br>
<br>
Reapplied after fixing the ASAN error which caused the revert:<br>
<a href="https://github.com/llvm/llvm-project/commit/db68a25ca90e0da46c9c33b027fa83260073bd28" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/db68a25ca90e0da46c9c33b027fa83260073bd28</a><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
llvm/include/llvm/Transforms/IPO/Attributor.h<br>
llvm/lib/Transforms/IPO/Attributor.cpp<br>
llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll<br>
llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll<br>
llvm/test/Transforms/Attributor/align.ll<br>
llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h<br>
index 6aa19b00e0f6b..123cfd5e1968e 100644<br>
--- a/llvm/include/llvm/Transforms/IPO/Attributor.h<br>
+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h<br>
@@ -1424,9 +1424,10 @@ struct Attributor {<br>
return AA;<br>
}<br>
<br>
- // If this is queried in the manifest stage, we force the AA to indicate<br>
- // pessimistic fixpoint immediately.<br>
- if (Phase == AttributorPhase::MANIFEST) {<br>
+ // If this is queried in the manifest or cleanup stage, we force the AA to<br>
+ // indicate pessimistic fixpoint immediately.<br>
+ if (Phase == AttributorPhase::MANIFEST ||<br>
+ Phase == AttributorPhase::CLEANUP) {<br>
AA.getState().indicatePessimisticFixpoint();<br>
return AA;<br>
}<br>
<br>
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp<br>
index 221e688d90660..dbb1e539af1a4 100644<br>
--- a/llvm/lib/Transforms/IPO/Attributor.cpp<br>
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp<br>
@@ -1188,16 +1188,14 @@ bool Attributor::isAssumedDead(const Instruction &I,<br>
if (ManifestAddedBlocks.contains(I.getParent()))<br>
return false;<br>
<br>
- if (!FnLivenessAA)<br>
- FnLivenessAA =<br>
- lookupAAFor<AAIsDead>(IRPosition::function(*I.getFunction(), CBCtx),<br>
- QueryingAA, DepClassTy::NONE);<br>
+ if (!FnLivenessAA || FnLivenessAA->getAnchorScope() != I.getFunction())<br>
+ FnLivenessAA = &getOrCreateAAFor<AAIsDead>(<br>
+ IRPosition::function(*I.getFunction(), CBCtx), QueryingAA,<br>
+ DepClassTy::NONE);<br>
<br>
// If we have a context instruction and a liveness AA we use it.<br>
- if (FnLivenessAA &&<br>
- FnLivenessAA->getIRPosition().getAnchorScope() == I.getFunction() &&<br>
- (CheckBBLivenessOnly ? FnLivenessAA->isAssumedDead(I.getParent())<br>
- : FnLivenessAA->isAssumedDead(&I))) {<br>
+ if (CheckBBLivenessOnly ? FnLivenessAA->isAssumedDead(I.getParent())<br>
+ : FnLivenessAA->isAssumedDead(&I)) {<br>
if (QueryingAA)<br>
recordDependence(*FnLivenessAA, *QueryingAA, DepClass);<br>
if (!FnLivenessAA->isKnownDead(&I))<br>
@@ -1268,9 +1266,9 @@ bool Attributor::isAssumedDead(const BasicBlock &BB,<br>
const AbstractAttribute *QueryingAA,<br>
const AAIsDead *FnLivenessAA,<br>
DepClassTy DepClass) {<br>
- if (!FnLivenessAA)<br>
- FnLivenessAA = lookupAAFor<AAIsDead>(IRPosition::function(*BB.getParent()),<br>
- QueryingAA, DepClassTy::NONE);<br>
+ if (!FnLivenessAA || FnLivenessAA->getAnchorScope() != BB.getParent())<br>
+ FnLivenessAA = &getOrCreateAAFor<AAIsDead>(<br>
+ IRPosition::function(*BB.getParent()), QueryingAA, DepClassTy::NONE);<br>
if (FnLivenessAA->isAssumedDead(&BB)) {<br>
if (QueryingAA)<br>
recordDependence(*FnLivenessAA, *QueryingAA, DepClass);<br>
<br>
diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll b/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll<br>
index 5a51fa46aaa66..b491b99b1c0d2 100644<br>
--- a/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll<br>
+++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-constant.ll<br>
@@ -1,6 +1,6 @@<br>
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals<br>
-; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
-; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
+; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
+; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM<br>
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM<br>
<br>
<br>
diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll<br>
index 84608789c0f53..0ad55e613a473 100644<br>
--- a/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll<br>
+++ b/llvm/test/Transforms/Attributor/IPConstantProp/return-constants.ll<br>
@@ -1,6 +1,6 @@<br>
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals<br>
-; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
-; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
+; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
+; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM<br>
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM<br>
<br>
<br>
diff --git a/llvm/test/Transforms/Attributor/align.ll b/llvm/test/Transforms/Attributor/align.ll<br>
index 3524f1da4719c..08b020c5a98ac 100644<br>
--- a/llvm/test/Transforms/Attributor/align.ll<br>
+++ b/llvm/test/Transforms/Attributor/align.ll<br>
@@ -138,12 +138,12 @@ define i32* @test6_2() #0 {<br>
define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 {<br>
; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
; IS__CGSCC____-LABEL: define {{[^@]+}}@f1<br>
-; IS__CGSCC____-SAME: (i8* noalias nofree noundef nonnull readnone returned align 8 dereferenceable(1) "no-capture-maybe-returned" [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {<br>
-; IS__CGSCC____-NEXT: br label [[TMP3:%.*]]<br>
-; IS__CGSCC____: 2:<br>
+; IS__CGSCC____-SAME: () local_unnamed_addr #[[ATTR0]] {<br>
+; IS__CGSCC____-NEXT: br label [[TMP2:%.*]]<br>
+; IS__CGSCC____: 1:<br>
; IS__CGSCC____-NEXT: unreachable<br>
-; IS__CGSCC____: 3:<br>
-; IS__CGSCC____-NEXT: ret i8* [[TMP0]]<br>
+; IS__CGSCC____: 2:<br>
+; IS__CGSCC____-NEXT: ret i8* @a1<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %3, label %5<br>
@@ -163,32 +163,24 @@ define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 {<br>
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2<br>
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {<br>
-; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
+; IS__CGSCC_OPM: 2:<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
; IS__CGSCC_OPM: 3:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]])<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP7:%.*]]<br>
-; IS__CGSCC_OPM: 5:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3(i8* nonnull @a2)<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP7]]<br>
-; IS__CGSCC_OPM: 7:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]<br>
-; IS__CGSCC_OPM-NEXT: ret i8* [[TMP8]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
+; IS__CGSCC_OPM: 4:<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
;<br>
; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2<br>
; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1:[0-9]+]] {<br>
-; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
+; IS__CGSCC_NPM: 2:<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
; IS__CGSCC_NPM: 3:<br>
-; IS__CGSCC_NPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 4294967296 dereferenceable(4294967295) [[TMP0]])<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP7:%.*]]<br>
-; IS__CGSCC_NPM: 5:<br>
-; IS__CGSCC_NPM-NEXT: [[TMP6:%.*]] = tail call i8* @f3()<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP7]]<br>
-; IS__CGSCC_NPM: 7:<br>
-; IS__CGSCC_NPM-NEXT: [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]<br>
-; IS__CGSCC_NPM-NEXT: ret i8* [[TMP8]]<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
+; IS__CGSCC_NPM: 4:<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %5, label %3<br>
@@ -212,23 +204,20 @@ define internal i8* @f3(i8* readnone %0) local_unnamed_addr #0 {<br>
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3<br>
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {<br>
-; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
+; IS__CGSCC_OPM: 2:<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
; IS__CGSCC_OPM: 3:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP4:%.*]] = tail call i8* @f1(i8* noalias noundef nonnull readnone align 16 dereferenceable(1) @a2)<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP5]]<br>
-; IS__CGSCC_OPM: 5:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]<br>
-; IS__CGSCC_OPM-NEXT: ret i8* [[TMP6]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
;<br>
-; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
+; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3<br>
-; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP2:%.*]]<br>
-; IS__CGSCC_NPM: 1:<br>
+; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {<br>
; IS__CGSCC_NPM-NEXT: unreachable<br>
; IS__CGSCC_NPM: 2:<br>
-; IS__CGSCC_NPM-NEXT: ret i8* @a1<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
+; IS__CGSCC_NPM: 3:<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %3, label %5<br>
@@ -253,12 +242,14 @@ define align 4 i8* @test7() #0 {<br>
; IS__CGSCC_OPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable<br>
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test7<br>
; IS__CGSCC_OPM-SAME: () #[[ATTR1]] {<br>
-; IS__CGSCC_OPM-NEXT: ret i8* @a1<br>
+; IS__CGSCC_OPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1() #[[ATTR13:[0-9]+]]<br>
+; IS__CGSCC_OPM-NEXT: ret i8* [[C]]<br>
;<br>
; IS__CGSCC_NPM: Function Attrs: nofree noinline nosync nounwind readnone willreturn uwtable<br>
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test7<br>
; IS__CGSCC_NPM-SAME: () #[[ATTR2:[0-9]+]] {<br>
-; IS__CGSCC_NPM-NEXT: ret i8* @a1<br>
+; IS__CGSCC_NPM-NEXT: [[C:%.*]] = tail call noundef nonnull align 8 dereferenceable(1) i8* @f1() #[[ATTR13:[0-9]+]]<br>
+; IS__CGSCC_NPM-NEXT: ret i8* [[C]]<br>
;<br>
%c = tail call i8* @f1(i8* align 8 dereferenceable(1) @a1)<br>
ret i8* %c<br>
@@ -267,23 +258,14 @@ define align 4 i8* @test7() #0 {<br>
; TEST 7b<br>
; Function Attrs: nounwind readnone ssp uwtable<br>
define internal i8* @f1b(i8* readnone %0) local_unnamed_addr #0 {<br>
-; IS__CGSCC_OPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
-; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f1b<br>
-; IS__CGSCC_OPM-SAME: (i8* noalias nocapture nofree nonnull readnone align 8 dereferenceable(1) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP3:%.*]]<br>
-; IS__CGSCC_OPM: 2:<br>
-; IS__CGSCC_OPM-NEXT: unreachable<br>
-; IS__CGSCC_OPM: 3:<br>
-; IS__CGSCC_OPM-NEXT: ret i8* undef<br>
-;<br>
-; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
-; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f1b<br>
-; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP2:%.*]]<br>
-; IS__CGSCC_NPM: 1:<br>
-; IS__CGSCC_NPM-NEXT: unreachable<br>
-; IS__CGSCC_NPM: 2:<br>
-; IS__CGSCC_NPM-NEXT: ret i8* undef<br>
+; IS__CGSCC____: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
+; IS__CGSCC____-LABEL: define {{[^@]+}}@f1b<br>
+; IS__CGSCC____-SAME: () local_unnamed_addr #[[ATTR0]] {<br>
+; IS__CGSCC____-NEXT: br label [[TMP2:%.*]]<br>
+; IS__CGSCC____: 1:<br>
+; IS__CGSCC____-NEXT: unreachable<br>
+; IS__CGSCC____: 2:<br>
+; IS__CGSCC____-NEXT: ret i8* undef<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %3, label %5<br>
@@ -305,30 +287,24 @@ define internal i8* @f2b(i8* readnone %0) local_unnamed_addr #0 {<br>
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f2b<br>
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {<br>
-; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
+; IS__CGSCC_OPM: 2:<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
; IS__CGSCC_OPM: 3:<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP6:%.*]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
; IS__CGSCC_OPM: 4:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b(i8* nonnull @a2)<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP6]]<br>
-; IS__CGSCC_OPM: 6:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ]<br>
-; IS__CGSCC_OPM-NEXT: ret i8* [[TMP7]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
;<br>
; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f2b<br>
; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {<br>
-; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_NPM-NEXT: br i1 [[TMP2]], label [[TMP4:%.*]], label [[TMP3:%.*]]<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
+; IS__CGSCC_NPM: 2:<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
; IS__CGSCC_NPM: 3:<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP6:%.*]]<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
; IS__CGSCC_NPM: 4:<br>
-; IS__CGSCC_NPM-NEXT: [[TMP5:%.*]] = tail call i8* @f3b()<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP6]]<br>
-; IS__CGSCC_NPM: 6:<br>
-; IS__CGSCC_NPM-NEXT: [[TMP7:%.*]] = phi i8* [ undef, [[TMP3]] ], [ [[TMP5]], [[TMP4]] ]<br>
-; IS__CGSCC_NPM-NEXT: ret i8* [[TMP7]]<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %5, label %3<br>
@@ -353,22 +329,20 @@ define internal i8* @f3b(i8* readnone %0) local_unnamed_addr #0 {<br>
; IS__CGSCC_OPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@f3b<br>
; IS__CGSCC_OPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {<br>
-; IS__CGSCC_OPM-NEXT: [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null<br>
-; IS__CGSCC_OPM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
+; IS__CGSCC_OPM: 2:<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
; IS__CGSCC_OPM: 3:<br>
-; IS__CGSCC_OPM-NEXT: br label [[TMP4]]<br>
-; IS__CGSCC_OPM: 4:<br>
-; IS__CGSCC_OPM-NEXT: [[TMP5:%.*]] = phi i8* [ @a2, [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]<br>
-; IS__CGSCC_OPM-NEXT: ret i8* [[TMP5]]<br>
+; IS__CGSCC_OPM-NEXT: unreachable<br>
;<br>
-; IS__CGSCC_NPM: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable<br>
+; IS__CGSCC_NPM: Function Attrs: noinline nounwind uwtable<br>
; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f3b<br>
-; IS__CGSCC_NPM-SAME: () local_unnamed_addr #[[ATTR0]] {<br>
-; IS__CGSCC_NPM-NEXT: br label [[TMP2:%.*]]<br>
-; IS__CGSCC_NPM: 1:<br>
+; IS__CGSCC_NPM-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr #[[ATTR1]] {<br>
; IS__CGSCC_NPM-NEXT: unreachable<br>
; IS__CGSCC_NPM: 2:<br>
-; IS__CGSCC_NPM-NEXT: ret i8* @a1<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
+; IS__CGSCC_NPM: 3:<br>
+; IS__CGSCC_NPM-NEXT: unreachable<br>
;<br>
%2 = icmp eq i8* %0, null<br>
br i1 %2, label %3, label %5<br>
@@ -1042,7 +1016,7 @@ define i32 @musttail_caller_1(i32* %p) {<br>
; IS__CGSCC____-NEXT: [[C:%.*]] = load i1, i1* @cnd, align 1<br>
; IS__CGSCC____-NEXT: br i1 [[C]], label [[MT:%.*]], label [[EXIT:%.*]]<br>
; IS__CGSCC____: mt:<br>
-; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR13:[0-9]+]]<br>
+; IS__CGSCC____-NEXT: [[V:%.*]] = musttail call i32 @musttail_callee_1(i32* nocapture nofree noundef nonnull readonly dereferenceable(4) [[P]]) #[[ATTR14:[0-9]+]]<br>
; IS__CGSCC____-NEXT: ret i32 [[V]]<br>
; IS__CGSCC____: exit:<br>
; IS__CGSCC____-NEXT: ret i32 0<br>
@@ -1180,7 +1154,7 @@ define i8* @aligned_8_return_caller(i8* align(16) %a, i1 %c1, i1 %c2) {<br>
; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn<br>
; IS__CGSCC____-LABEL: define {{[^@]+}}@aligned_8_return_caller<br>
; IS__CGSCC____-SAME: (i8* nofree readnone align 16 [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR12:[0-9]+]] {<br>
-; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR14:[0-9]+]]<br>
+; IS__CGSCC____-NEXT: [[R:%.*]] = call align 8 i8* @aligned_8_return(i8* noalias nofree readnone align 16 [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]]<br>
; IS__CGSCC____-NEXT: ret i8* [[R]]<br>
;<br>
%r = call i8* @aligned_8_return(i8* %a, i1 %c1, i1 %c2)<br>
@@ -1218,8 +1192,8 @@ attributes #2 = { null_pointer_is_valid }<br>
; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn }<br>
; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn }<br>
; IS__CGSCC_OPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn }<br>
-; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readonly willreturn }<br>
-; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readnone willreturn }<br>
+; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readnone willreturn }<br>
+; IS__CGSCC_OPM: attributes #[[ATTR14]] = { readonly willreturn }<br>
;.<br>
; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone willreturn uwtable }<br>
; IS__CGSCC_NPM: attributes #[[ATTR1]] = { noinline nounwind uwtable }<br>
@@ -1234,6 +1208,6 @@ attributes #2 = { null_pointer_is_valid }<br>
; IS__CGSCC_NPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn }<br>
; IS__CGSCC_NPM: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn }<br>
; IS__CGSCC_NPM: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn }<br>
-; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readonly willreturn }<br>
-; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readnone willreturn }<br>
+; IS__CGSCC_NPM: attributes #[[ATTR13]] = { readnone willreturn }<br>
+; IS__CGSCC_NPM: attributes #[[ATTR14]] = { readonly willreturn }<br>
;.<br>
<br>
diff --git a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll<br>
index 1070923a6ea37..3f125270cdd7a 100644<br>
--- a/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll<br>
+++ b/llvm/test/Transforms/Attributor/read_write_returned_arguments_scc.ll<br>
@@ -1,6 +1,6 @@<br>
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals<br>
-; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=8 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
-; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
+; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM<br>
+; 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,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM<br>
; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM<br>
; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM<br>
<br>
@@ -41,7 +41,7 @@ define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) {<br>
; IS__TUNIT____-NEXT: entry:<br>
; IS__TUNIT____-NEXT: [[CALL:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree [[W0]]) #[[ATTR3:[0-9]+]]<br>
; IS__TUNIT____-NEXT: [[CALL1:%.*]] = call i32* @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR3]]<br>
-; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR3]]<br>
+; IS__TUNIT____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly align 4 [[R0]], i32* nofree writeonly "no-capture-maybe-returned" [[W0]]) #[[ATTR3]]<br>
; IS__TUNIT____-NEXT: [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR3]]<br>
; IS__TUNIT____-NEXT: ret i32* [[CALL3]]<br>
;<br>
@@ -51,7 +51,7 @@ define i32* @external_ret2_nrw(i32* %n0, i32* %r0, i32* %w0) {<br>
; IS__CGSCC____-NEXT: entry:<br>
; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32* @internal_ret0_nw(i32* nofree [[N0]], i32* nofree [[W0]]) #[[ATTR2:[0-9]+]]<br>
; IS__CGSCC____-NEXT: [[CALL1:%.*]] = call i32* @internal_ret1_rrw(i32* nofree align 4 [[R0]], i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR2]]<br>
-; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]]<br>
+; IS__CGSCC____-NEXT: [[CALL2:%.*]] = call i32* @external_sink_ret2_nrw(i32* nofree [[N0]], i32* nocapture nofree readonly align 4 [[R0]], i32* nofree writeonly [[W0]]) #[[ATTR3:[0-9]+]]<br>
; IS__CGSCC____-NEXT: [[CALL3:%.*]] = call i32* @internal_ret1_rw(i32* nofree align 4 [[R0]], i32* nofree [[W0]]) #[[ATTR2]]<br>
; IS__CGSCC____-NEXT: ret i32* [[CALL3]]<br>
;<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>