[llvm] 7d16a35 - [Attributor][FIX] Do not ignore refinement for IPO
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 23 20:10:32 PDT 2023
Author: Johannes Doerfert
Date: 2023-06-23T20:10:12-07:00
New Revision: 7d16a35c83d239a8fba44bdff9ffadcc32bb524b
URL: https://github.com/llvm/llvm-project/commit/7d16a35c83d239a8fba44bdff9ffadcc32bb524b
DIFF: https://github.com/llvm/llvm-project/commit/7d16a35c83d239a8fba44bdff9ffadcc32bb524b.diff
LOG: [Attributor][FIX] Do not ignore refinement for IPO
This is just a cleanup commit, a follow up will make this way more
structured.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
llvm/test/Transforms/Attributor/alwaysinline.ll
llvm/test/Transforms/Attributor/internalize.ll
llvm/test/Transforms/Attributor/returned.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 1b3039fc2256b..4d32a0899e559 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -10802,8 +10802,16 @@ struct AACallEdgesFunction : public AACallEdgesImpl {
struct AAInterFnReachabilityFunction
: public CachedReachabilityAA<AAInterFnReachability, Function> {
+ using Base = CachedReachabilityAA<AAInterFnReachability, Function>;
AAInterFnReachabilityFunction(const IRPosition &IRP, Attributor &A)
- : CachedReachabilityAA<AAInterFnReachability, Function>(IRP, A) {}
+ : Base(IRP, A) {}
+
+ void initialize(Attributor &A) override {
+ Base::initialize(A);
+ Function *F = getAssociatedFunction();
+ if (!F || F->isDeclaration() || !A.isFunctionIPOAmendable(*F))
+ indicatePessimisticFixpoint();
+ }
bool instructionCanReach(
Attributor &A, const Instruction &From, const Function &To,
diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll b/llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
index 8410cb53b4a8b..f1872e0cd40d6 100644
--- a/llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
+++ b/llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll
@@ -17,19 +17,12 @@ entry:
}
define i32 @main() nounwind {
-; TUNIT: Function Attrs: norecurse nounwind
-; TUNIT-LABEL: define {{[^@]+}}@main
-; TUNIT-SAME: () #[[ATTR1:[0-9]+]] {
-; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[R:%.*]] = call i32 @foo() #[[ATTR0]]
-; TUNIT-NEXT: ret i32 [[R]]
-;
-; CGSCC: Function Attrs: nounwind
-; CGSCC-LABEL: define {{[^@]+}}@main
-; CGSCC-SAME: () #[[ATTR0]] {
-; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[R:%.*]] = call i32 @foo() #[[ATTR0]]
-; CGSCC-NEXT: ret i32 [[R]]
+; CHECK: Function Attrs: nounwind
+; CHECK-LABEL: define {{[^@]+}}@main
+; CHECK-SAME: () #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[R:%.*]] = call i32 @foo() #[[ATTR0]]
+; CHECK-NEXT: ret i32 [[R]]
;
entry:
%r = call i32 @foo( ) nounwind
@@ -37,8 +30,8 @@ entry:
}
;.
-; TUNIT: attributes #[[ATTR0]] = { nounwind }
-; TUNIT: attributes #[[ATTR1]] = { norecurse nounwind }
-;.
-; CGSCC: attributes #[[ATTR0]] = { nounwind }
+; CHECK: attributes #[[ATTR0]] = { nounwind }
;.
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CGSCC: {{.*}}
+; TUNIT: {{.*}}
diff --git a/llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll b/llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
index af24e185f7b1f..5c81e45094f5e 100644
--- a/llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
+++ b/llvm/test/Transforms/Attributor/IPConstantProp/comdat-ipo.ll
@@ -30,23 +30,14 @@ define linkonce_odr i32 @foo() {
}
define i32 @bar() {
-; TUNIT: Function Attrs: norecurse
-; TUNIT-LABEL: define {{[^@]+}}@bar
-; TUNIT-SAME: () #[[ATTR1:[0-9]+]] {
-; TUNIT-NEXT: [[VAL:%.*]] = call i32 @foo()
-; TUNIT-NEXT: ret i32 [[VAL]]
-;
-; CGSCC-LABEL: define {{[^@]+}}@bar() {
-; CGSCC-NEXT: [[VAL:%.*]] = call i32 @foo()
-; CGSCC-NEXT: ret i32 [[VAL]]
+; CHECK-LABEL: define {{[^@]+}}@bar() {
+; CHECK-NEXT: [[VAL:%.*]] = call i32 @foo()
+; CHECK-NEXT: ret i32 [[VAL]]
;
%val = call i32 @foo()
ret i32 %val
}
;.
-; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR1]] = { norecurse }
-;.
-; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
+; CHECK: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
;.
diff --git a/llvm/test/Transforms/Attributor/alwaysinline.ll b/llvm/test/Transforms/Attributor/alwaysinline.ll
index 60f7060614b6a..65c0fa23870d7 100644
--- a/llvm/test/Transforms/Attributor/alwaysinline.ll
+++ b/llvm/test/Transforms/Attributor/alwaysinline.ll
@@ -49,17 +49,10 @@ entry:
; CHECK-NOT: Function Attrs
define i32 @outer2() {
-; TUNIT: Function Attrs: norecurse
-; TUNIT-LABEL: define {{[^@]+}}@outer2
-; TUNIT-SAME: () #[[ATTR2:[0-9]+]] {
-; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[R:%.*]] = call i32 @inner2() #[[ATTR3:[0-9]+]]
-; TUNIT-NEXT: ret i32 [[R]]
-;
-; CGSCC-LABEL: define {{[^@]+}}@outer2() {
-; CGSCC-NEXT: entry:
-; CGSCC-NEXT: [[R:%.*]] = call i32 @inner2() #[[ATTR2:[0-9]+]]
-; CGSCC-NEXT: ret i32 [[R]]
+; CHECK-LABEL: define {{[^@]+}}@outer2() {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[R:%.*]] = call i32 @inner2() #[[ATTR2:[0-9]+]]
+; CHECK-NEXT: ret i32 [[R]]
;
entry:
%r = call i32 @inner2() alwaysinline
@@ -70,25 +63,15 @@ entry:
; it is `unexactly defined` and alwaysinline but cannot be inlined.
; so it will not be analyzed
define linkonce i32 @inner3(ptr %addr) alwaysinline {
-; TUNIT: Function Attrs: alwaysinline
-; TUNIT-LABEL: define {{[^@]+}}@inner3
-; TUNIT-SAME: (ptr [[ADDR:%.*]]) #[[ATTR3]] {
-; TUNIT-NEXT: entry:
-; TUNIT-NEXT: indirectbr ptr [[ADDR]], [label [[ONE:%.*]], label %two]
-; TUNIT: one:
-; TUNIT-NEXT: ret i32 42
-; TUNIT: two:
-; TUNIT-NEXT: ret i32 44
-;
-; CGSCC: Function Attrs: alwaysinline
-; CGSCC-LABEL: define {{[^@]+}}@inner3
-; CGSCC-SAME: (ptr [[ADDR:%.*]]) #[[ATTR2]] {
-; CGSCC-NEXT: entry:
-; CGSCC-NEXT: indirectbr ptr [[ADDR]], [label [[ONE:%.*]], label %two]
-; CGSCC: one:
-; CGSCC-NEXT: ret i32 42
-; CGSCC: two:
-; CGSCC-NEXT: ret i32 44
+; CHECK: Function Attrs: alwaysinline
+; CHECK-LABEL: define {{[^@]+}}@inner3
+; CHECK-SAME: (ptr [[ADDR:%.*]]) #[[ATTR2]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: indirectbr ptr [[ADDR]], [label [[ONE:%.*]], label %two]
+; CHECK: one:
+; CHECK-NEXT: ret i32 42
+; CHECK: two:
+; CHECK-NEXT: ret i32 44
;
entry:
indirectbr ptr %addr, [ label %one, label %two ]
@@ -101,20 +84,12 @@ two:
}
define i32 @outer3(i32 %x) {
-; TUNIT: Function Attrs: norecurse
-; TUNIT-LABEL: define {{[^@]+}}@outer3
-; TUNIT-SAME: (i32 [[X:%.*]]) #[[ATTR2]] {
-; TUNIT-NEXT: [[CMP:%.*]] = icmp slt i32 [[X]], 42
-; TUNIT-NEXT: [[ADDR:%.*]] = select i1 [[CMP]], ptr blockaddress(@inner3, [[ONE:%.*]]), ptr blockaddress(@inner3, [[TWO:%.*]])
-; TUNIT-NEXT: [[CALL:%.*]] = call i32 @inner3(ptr [[ADDR]])
-; TUNIT-NEXT: ret i32 [[CALL]]
-;
-; CGSCC-LABEL: define {{[^@]+}}@outer3
-; CGSCC-SAME: (i32 [[X:%.*]]) {
-; CGSCC-NEXT: [[CMP:%.*]] = icmp slt i32 [[X]], 42
-; CGSCC-NEXT: [[ADDR:%.*]] = select i1 [[CMP]], ptr blockaddress(@inner3, [[ONE:%.*]]), ptr blockaddress(@inner3, [[TWO:%.*]])
-; CGSCC-NEXT: [[CALL:%.*]] = call i32 @inner3(ptr [[ADDR]])
-; CGSCC-NEXT: ret i32 [[CALL]]
+; CHECK-LABEL: define {{[^@]+}}@outer3
+; CHECK-SAME: (i32 [[X:%.*]]) {
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[X]], 42
+; CHECK-NEXT: [[ADDR:%.*]] = select i1 [[CMP]], ptr blockaddress(@inner3, [[ONE:%.*]]), ptr blockaddress(@inner3, [[TWO:%.*]])
+; CHECK-NEXT: [[CALL:%.*]] = call i32 @inner3(ptr [[ADDR]])
+; CHECK-NEXT: ret i32 [[CALL]]
;
%cmp = icmp slt i32 %x, 42
%addr = select i1 %cmp, ptr blockaddress(@inner3, %one), ptr blockaddress(@inner3, %two)
@@ -124,8 +99,7 @@ define i32 @outer3(i32 %x) {
;.
; TUNIT: attributes #[[ATTR0]] = { alwaysinline mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR2]] = { norecurse }
-; TUNIT: attributes #[[ATTR3]] = { alwaysinline }
+; TUNIT: attributes #[[ATTR2]] = { alwaysinline }
;.
; CGSCC: attributes #[[ATTR0]] = { alwaysinline mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
diff --git a/llvm/test/Transforms/Attributor/internalize.ll b/llvm/test/Transforms/Attributor/internalize.ll
index e910299ae52e2..96602ad997685 100644
--- a/llvm/test/Transforms/Attributor/internalize.ll
+++ b/llvm/test/Transforms/Attributor/internalize.ll
@@ -91,9 +91,7 @@ entry:
; copied one
;
define i32 @outer1() {
-; CHECK_DISABLED: Function Attrs: norecurse
-; CHECK_DISABLED-LABEL: define {{[^@]+}}@outer1
-; CHECK_DISABLED-SAME: () #[[ATTR0:[0-9]+]] {
+; CHECK_DISABLED-LABEL: define {{[^@]+}}@outer1() {
; CHECK_DISABLED-NEXT: entry:
; CHECK_DISABLED-NEXT: [[RET1:%.*]] = call i32 @inner1(i32 noundef 1, i32 noundef 2)
; CHECK_DISABLED-NEXT: [[RET2:%.*]] = call i32 @inner2(i32 noundef 1, i32 noundef 2)
@@ -101,9 +99,7 @@ define i32 @outer1() {
; CHECK_DISABLED-NEXT: [[RET4:%.*]] = call i32 @inner4(i32 [[RET3]], i32 [[RET3]])
; CHECK_DISABLED-NEXT: ret i32 [[RET4]]
;
-; CHECK_ENABLED: Function Attrs: norecurse
-; CHECK_ENABLED-LABEL: define {{[^@]+}}@outer1
-; CHECK_ENABLED-SAME: () #[[ATTR1:[0-9]+]] {
+; CHECK_ENABLED-LABEL: define {{[^@]+}}@outer1() {
; CHECK_ENABLED-NEXT: entry:
; CHECK_ENABLED-NEXT: [[RET1:%.*]] = call i32 @inner1(i32 noundef 1, i32 noundef 2)
; CHECK_ENABLED-NEXT: [[RET2:%.*]] = call i32 @inner2(i32 noundef 1, i32 noundef 2)
@@ -129,9 +125,7 @@ define linkonce_odr void @unused_arg(i8) {
}
define void @unused_arg_caller() {
-; CHECK_DISABLED: Function Attrs: norecurse
-; CHECK_DISABLED-LABEL: define {{[^@]+}}@unused_arg_caller
-; CHECK_DISABLED-SAME: () #[[ATTR0]] {
+; CHECK_DISABLED-LABEL: define {{[^@]+}}@unused_arg_caller() {
; CHECK_DISABLED-NEXT: call void @unused_arg(i8 noundef 0)
; CHECK_DISABLED-NEXT: ret void
;
@@ -162,9 +156,6 @@ define linkonce_odr hidden void @__clang_call_terminate() {
; CGSCC_ENABLED: attributes #[[ATTR1:[0-9]+]] = { nofree noreturn nosync nounwind readnone willreturn }
; CGSCC_ENABLED: attributes #[[ATTR2]] = { nofree norecurse noreturn nosync nounwind readnone willreturn }
;.
-; CHECK_DISABLED: attributes #[[ATTR0]] = { norecurse }
-;.
; CHECK_ENABLED: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; CHECK_ENABLED: attributes #[[ATTR1]] = { norecurse }
-; CHECK_ENABLED: attributes #[[ATTR2:[0-9]+]] = { nounwind }
+; CHECK_ENABLED: attributes #[[ATTR1:[0-9]+]] = { nounwind }
;.
diff --git a/llvm/test/Transforms/Attributor/returned.ll b/llvm/test/Transforms/Attributor/returned.ll
index 0764feebaba10..879b1197b60f6 100644
--- a/llvm/test/Transforms/Attributor/returned.ll
+++ b/llvm/test/Transforms/Attributor/returned.ll
@@ -56,7 +56,7 @@ define i32 @scc_r1(i32 %a, i32 %r, i32 %b) #0 {
; TUNIT-LABEL: define {{[^@]+}}@scc_r1
; TUNIT-SAME: (i32 [[A:%.*]], i32 returned [[R:%.*]], i32 [[B:%.*]]) #[[ATTR1:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[A]], i32 [[R]]) #[[ATTR10:[0-9]+]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[A]], i32 [[R]]) #[[ATTR8:[0-9]+]]
; TUNIT-NEXT: ret i32 [[R]]
;
; CGSCC: Function Attrs: nofree noinline nosync nounwind memory(none) uwtable
@@ -80,18 +80,18 @@ define i32 @scc_r2(i32 %a, i32 %b, i32 %r) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[A]], i32 [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[A]], i32 [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN:%.*]]
; TUNIT: if.end:
; TUNIT-NEXT: [[CMP2:%.*]] = icmp slt i32 [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP2]], label [[IF_THEN3:%.*]], label [[IF_END12:%.*]]
; TUNIT: if.then3:
-; TUNIT-NEXT: [[CALL5:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL6:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[R]], i32 [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL7:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[R]], i32 undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL8:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL9:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[R]], i32 [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL11:%.*]] = call i32 @scc_r1(i32 [[B]], i32 [[R]], i32 undef) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL5:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL6:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[R]], i32 [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL7:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[R]], i32 undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL8:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL9:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[R]], i32 [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL11:%.*]] = call i32 @scc_r1(i32 [[B]], i32 [[R]], i32 undef) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN]]
; TUNIT: if.end12:
; TUNIT-NEXT: [[CMP13:%.*]] = icmp eq i32 [[A]], [[B]]
@@ -99,7 +99,7 @@ define i32 @scc_r2(i32 %a, i32 %b, i32 %r) #0 {
; TUNIT: cond.true:
; TUNIT-NEXT: br label [[COND_END:%.*]]
; TUNIT: cond.false:
-; TUNIT-NEXT: [[CALL14:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL14:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[COND_END]]
; TUNIT: cond.end:
; TUNIT-NEXT: [[COND:%.*]] = phi i32 [ [[R]], [[COND_TRUE]] ], [ [[R]], [[COND_FALSE]] ]
@@ -195,18 +195,18 @@ define i32 @scc_rX(i32 %a, i32 %b, i32 %r) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[A]], i32 [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[A]], i32 [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN:%.*]]
; TUNIT: if.end:
; TUNIT-NEXT: [[CMP2:%.*]] = icmp slt i32 [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP2]], label [[IF_THEN3:%.*]], label [[IF_END12:%.*]]
; TUNIT: if.then3:
-; TUNIT-NEXT: [[CALL5:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL6:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[R]], i32 [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL7:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[R]], i32 undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL8:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL9:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[R]], i32 [[B]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL11:%.*]] = call i32 @scc_r1(i32 [[B]], i32 [[B]], i32 undef) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL5:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL6:%.*]] = call i32 @scc_r2(i32 [[R]], i32 [[R]], i32 [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL7:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[R]], i32 undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL8:%.*]] = call i32 @scc_r1(i32 [[A]], i32 [[B]], i32 undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL9:%.*]] = call i32 @scc_r2(i32 [[B]], i32 [[R]], i32 [[B]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL11:%.*]] = call i32 @scc_r1(i32 [[B]], i32 [[B]], i32 undef) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN]]
; TUNIT: if.end12:
; TUNIT-NEXT: [[CMP13:%.*]] = icmp eq i32 [[A]], [[B]]
@@ -214,7 +214,7 @@ define i32 @scc_rX(i32 %a, i32 %b, i32 %r) #0 {
; TUNIT: cond.true:
; TUNIT-NEXT: br label [[COND_END:%.*]]
; TUNIT: cond.false:
-; TUNIT-NEXT: [[CALL14:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL14:%.*]] = call i32 @scc_r2(i32 [[A]], i32 [[B]], i32 [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[COND_END]]
; TUNIT: cond.end:
; TUNIT-NEXT: [[COND:%.*]] = phi i32 [ [[R]], [[COND_TRUE]] ], [ [[R]], [[COND_FALSE]] ]
@@ -340,7 +340,7 @@ define ptr @ptr_scc_r1(ptr %a, ptr %r, ptr %b) #0 {
; TUNIT-LABEL: define {{[^@]+}}@ptr_scc_r1
; TUNIT-SAME: (ptr nocapture nofree readnone [[A:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[R:%.*]], ptr nocapture nofree readnone [[B:%.*]]) #[[ATTR1]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[R]], ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[R]], ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[R]]
;
; CGSCC: Function Attrs: nofree noinline nosync nounwind memory(none) uwtable
@@ -364,18 +364,18 @@ define ptr @ptr_scc_r2(ptr %a, ptr %b, ptr %r) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp ugt ptr [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[B]], ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL1:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[B]], ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN:%.*]]
; TUNIT: if.end:
; TUNIT-NEXT: [[CMP2:%.*]] = icmp ult ptr [[A]], [[B]]
; TUNIT-NEXT: br i1 [[CMP2]], label [[IF_THEN3:%.*]], label [[IF_END12:%.*]]
; TUNIT: if.then3:
-; TUNIT-NEXT: [[CALL5:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]], ptr noalias nocapture nofree readnone undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL6:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[R]], ptr noalias nocapture nofree readnone [[R]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL7:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]], ptr noalias nocapture nofree readnone undef) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL8:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[A]], ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL9:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[B]], ptr noalias nocapture nofree readnone [[R]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
-; TUNIT-NEXT: [[CALL11:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]], ptr noalias nocapture nofree readnone undef) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL5:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]], ptr noalias nocapture nofree readnone undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL6:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[R]], ptr noalias nocapture nofree readnone [[R]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL7:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]], ptr noalias nocapture nofree readnone undef) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL8:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[A]], ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL9:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[B]], ptr noalias nocapture nofree readnone [[R]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
+; TUNIT-NEXT: [[CALL11:%.*]] = call ptr @ptr_scc_r1(ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]], ptr noalias nocapture nofree readnone undef) #[[ATTR8]]
; TUNIT-NEXT: br label [[RETURN]]
; TUNIT: if.end12:
; TUNIT-NEXT: [[CMP13:%.*]] = icmp eq ptr [[A]], [[B]]
@@ -383,7 +383,7 @@ define ptr @ptr_scc_r2(ptr %a, ptr %b, ptr %r) #0 {
; TUNIT: cond.true:
; TUNIT-NEXT: br label [[COND_END:%.*]]
; TUNIT: cond.false:
-; TUNIT-NEXT: [[CALL14:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[A]], ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL14:%.*]] = call ptr @ptr_scc_r2(ptr noalias nocapture nofree readnone [[A]], ptr noalias nocapture nofree readnone [[B]], ptr noalias nofree readnone "no-capture-maybe-returned" [[R]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[COND_END]]
; TUNIT: cond.end:
; TUNIT-NEXT: [[COND:%.*]] = phi ptr [ [[R]], [[COND_TRUE]] ], [ [[R]], [[COND_FALSE]] ]
@@ -483,7 +483,7 @@ define ptr @rt0(ptr %a) #0 {
; TUNIT-LABEL: define {{[^@]+}}@rt0
; TUNIT-SAME: (ptr nofree noundef nonnull readonly returned align 4 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR3:[0-9]+]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt0(ptr nofree noundef nonnull readonly align 4 dereferenceable(4) "no-capture-maybe-returned" [[A]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt0(ptr nofree noundef nonnull readonly align 4 dereferenceable(4) "no-capture-maybe-returned" [[A]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[A]]
;
; CGSCC: Function Attrs: nofree noinline nosync nounwind memory(argmem: read) uwtable
@@ -535,7 +535,7 @@ define ptr @rt2_helper(ptr %a) #0 {
; TUNIT-LABEL: define {{[^@]+}}@rt2_helper
; TUNIT-SAME: (ptr nofree readnone returned [[A:%.*]]) #[[ATTR1]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt2(ptr noalias nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[A]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt2(ptr noalias nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[A]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[A]]
;
; CGSCC: Function Attrs: nofree noinline nosync nounwind memory(none) uwtable
@@ -558,7 +558,7 @@ define ptr @rt2(ptr %a, ptr %b) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp eq ptr [[A]], null
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt2_helper(ptr noalias nofree readnone [[A]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt2_helper(ptr noalias nofree readnone [[A]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: [[SEL:%.*]] = phi ptr [ [[B]], [[ENTRY:%.*]] ], [ [[A]], [[IF_THEN]] ]
@@ -597,7 +597,7 @@ define ptr @rt3_helper(ptr %a, ptr %b) #0 {
; TUNIT-LABEL: define {{[^@]+}}@rt3_helper
; TUNIT-SAME: (ptr nocapture nofree readnone [[A:%.*]], ptr nofree readnone returned "no-capture-maybe-returned" [[B:%.*]]) #[[ATTR1]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt3(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt3(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]]) #[[ATTR8]]
; TUNIT-NEXT: ret ptr [[B]]
;
; CGSCC: Function Attrs: nofree noinline nosync nounwind memory(none) uwtable
@@ -620,7 +620,7 @@ define ptr @rt3(ptr %a, ptr %b) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp eq ptr [[A]], null
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt3_helper(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @rt3_helper(ptr noalias nocapture nofree readnone [[A]], ptr noalias nofree readnone "no-capture-maybe-returned" [[B]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: [[SEL:%.*]] = phi ptr [ [[B]], [[ENTRY:%.*]] ], [ [[B]], [[IF_THEN]] ]
@@ -667,7 +667,7 @@ define ptr @calls_unknown_fn(ptr %r) #0 {
; TUNIT: Function Attrs: noinline nounwind uwtable
; TUNIT-LABEL: define {{[^@]+}}@calls_unknown_fn
; TUNIT-SAME: (ptr nofree readnone returned "no-capture-maybe-returned" [[R:%.*]]) #[[ATTR5:[0-9]+]] {
-; TUNIT-NEXT: tail call void @unknown_fn(ptr noundef nonnull @calls_unknown_fn) #[[ATTR11:[0-9]+]]
+; TUNIT-NEXT: tail call void @unknown_fn(ptr noundef nonnull @calls_unknown_fn) #[[ATTR9:[0-9]+]]
; TUNIT-NEXT: ret ptr [[R]]
;
; CGSCC: Function Attrs: noinline nounwind uwtable
@@ -712,11 +712,11 @@ entry:
}
define ptr @calls_maybe_redefined_fn(ptr %r) #0 {
-; TUNIT: Function Attrs: noinline norecurse nounwind uwtable
+; TUNIT: Function Attrs: noinline nounwind uwtable
; TUNIT-LABEL: define {{[^@]+}}@calls_maybe_redefined_fn
-; TUNIT-SAME: (ptr returned [[R:%.*]]) #[[ATTR6:[0-9]+]] {
+; TUNIT-SAME: (ptr returned [[R:%.*]]) #[[ATTR5]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @maybe_redefined_fn(ptr [[R]]) #[[ATTR11]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @maybe_redefined_fn(ptr [[R]]) #[[ATTR9]]
; TUNIT-NEXT: ret ptr [[R]]
;
; CGSCC: Function Attrs: noinline nounwind uwtable
@@ -761,11 +761,11 @@ entry:
}
define ptr @calls_maybe_redefined_fn2(ptr %r) #0 {
-; TUNIT: Function Attrs: noinline norecurse nounwind uwtable
+; TUNIT: Function Attrs: noinline nounwind uwtable
; TUNIT-LABEL: define {{[^@]+}}@calls_maybe_redefined_fn2
-; TUNIT-SAME: (ptr [[R:%.*]]) #[[ATTR6]] {
+; TUNIT-SAME: (ptr [[R:%.*]]) #[[ATTR5]] {
; TUNIT-NEXT: entry:
-; TUNIT-NEXT: [[CALL:%.*]] = call ptr @maybe_redefined_fn2(ptr [[R]]) #[[ATTR11]]
+; TUNIT-NEXT: [[CALL:%.*]] = call ptr @maybe_redefined_fn2(ptr [[R]]) #[[ATTR9]]
; TUNIT-NEXT: ret ptr [[CALL]]
;
; CGSCC: Function Attrs: noinline nounwind uwtable
@@ -836,7 +836,7 @@ define double @recursion_select_and_phi(i32 %a, double %b) #0 {
; TUNIT-NEXT: [[CMP:%.*]] = icmp sgt i32 [[A]], 0
; TUNIT-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[IF_END:%.*]]
; TUNIT: if.then:
-; TUNIT-NEXT: [[CALL:%.*]] = call double @recursion_select_and_phi(i32 [[DEC]], double [[B]]) #[[ATTR10]]
+; TUNIT-NEXT: [[CALL:%.*]] = call double @recursion_select_and_phi(i32 [[DEC]], double [[B]]) #[[ATTR8]]
; TUNIT-NEXT: br label [[IF_END]]
; TUNIT: if.end:
; TUNIT-NEXT: [[PHI:%.*]] = phi double [ [[B]], [[IF_THEN]] ], [ [[B]], [[ENTRY:%.*]] ]
@@ -1262,7 +1262,7 @@ define i32 @deadblockphi3(i32 %A, i1 %c) #0 {
; TUNIT-NEXT: entry:
; TUNIT-NEXT: br i1 [[C]], label [[R:%.*]], label [[UNREACHABLECALL:%.*]]
; TUNIT: unreachablecall:
-; TUNIT-NEXT: call void @noreturn() #[[ATTR7:[0-9]+]]
+; TUNIT-NEXT: call void @noreturn() #[[ATTR6:[0-9]+]]
; TUNIT-NEXT: unreachable
; TUNIT: unreachableblock2:
; TUNIT-NEXT: unreachable
@@ -1342,9 +1342,8 @@ define weak_odr align 16 ptr @non_exact_4(ptr align 32 %a) {
; We can use the return information of the weak function non_exact_4.
; FIXME: %c2 and %c3 should be replaced but not %c0 or %c1!
define i32 @exact(ptr align 8 %a, ptr align 8 %b) {
-; TUNIT: Function Attrs: norecurse
; TUNIT-LABEL: define {{[^@]+}}@exact
-; TUNIT-SAME: (ptr align 8 [[A:%.*]], ptr align 8 [[B:%.*]]) #[[ATTR8:[0-9]+]] {
+; TUNIT-SAME: (ptr align 8 [[A:%.*]], ptr align 8 [[B:%.*]]) {
; TUNIT-NEXT: [[C0:%.*]] = call i32 @non_exact_0()
; TUNIT-NEXT: [[C1:%.*]] = call i32 @non_exact_1(i32 noundef 1)
; TUNIT-NEXT: [[C2:%.*]] = call i32 @non_exact_2(i32 noundef 2)
@@ -1475,12 +1474,10 @@ attributes #0 = { noinline nounwind uwtable }
; TUNIT: attributes #[[ATTR3]] = { nofree noinline nosync nounwind memory(argmem: read) uwtable }
; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree noinline nosync nounwind willreturn memory(none) uwtable }
; TUNIT: attributes #[[ATTR5]] = { noinline nounwind uwtable }
-; TUNIT: attributes #[[ATTR6]] = { noinline norecurse nounwind uwtable }
-; TUNIT: attributes #[[ATTR7]] = { noreturn }
-; TUNIT: attributes #[[ATTR8]] = { norecurse }
-; TUNIT: attributes #[[ATTR9:[0-9]+]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
-; TUNIT: attributes #[[ATTR10]] = { nofree nosync nounwind }
-; TUNIT: attributes #[[ATTR11]] = { nounwind }
+; TUNIT: attributes #[[ATTR6]] = { noreturn }
+; TUNIT: attributes #[[ATTR7:[0-9]+]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
+; TUNIT: attributes #[[ATTR8]] = { nofree nosync nounwind }
+; TUNIT: attributes #[[ATTR9]] = { nounwind }
;.
; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }
; CGSCC: attributes #[[ATTR1]] = { nofree noinline nosync nounwind memory(none) uwtable }
More information about the llvm-commits
mailing list