diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index 2cac89a9c7c8..686c233a46ef 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -6031,6 +6031,8 @@ ChangeStatus Attributor::run(Module &M) { assert(DOIAAState.isAtFixpoint() && "Expected fixpoint state!"); if (!DOIAAState.isValidState()) InvalidAAs.insert(DepOnInvalidAA); + else + ChangedAAs.push_back(DepOnInvalidAA); } if (!RecomputeDependences) Worklist.insert(QuerriedAAs.OptionalAAs.begin(), diff --git a/llvm/test/Transforms/Attributor/dereferenceable-1.ll b/llvm/test/Transforms/Attributor/dereferenceable-1.ll index 56220c2cfdb4..bc16ab8f0c43 100644 --- a/llvm/test/Transforms/Attributor/dereferenceable-1.ll +++ b/llvm/test/Transforms/Attributor/dereferenceable-1.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -attributor -attributor-manifest-internal --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR +; RUN: opt -attributor -attributor-manifest-internal --attributor-disable=false -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=5 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR declare void @deref_phi_user(i32* %a); diff --git a/llvm/test/Transforms/Attributor/range.ll b/llvm/test/Transforms/Attributor/range.ll index a73a1ea23c70..10b16e432cde 100644 --- a/llvm/test/Transforms/Attributor/range.ll +++ b/llvm/test/Transforms/Attributor/range.ll @@ -1,5 +1,6 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt -passes=attributor -attributor-disable=false -S < %s | FileCheck %s +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes +; RUN: opt -attributor -attributor-disable=false -S < %s | FileCheck %s --check-prefixes=CHECK,OLD_PM +; RUN: opt -passes=attributor -attributor-disable=false -S < %s | FileCheck %s --check-prefixes=CHECK,NEW_PM define i32 @test0(i32* %p) { ; CHECK-LABEL: define {{[^@]+}}@test0 @@ -279,21 +280,38 @@ return: ; preds = %if.end, %if.then declare dso_local void @unkown() define internal i32 @r1(i32) local_unnamed_addr { -; CHECK-LABEL: define {{[^@]+}}@r1() local_unnamed_addr -; CHECK-NEXT: br label [[TMP3:%.*]] -; CHECK: 1: -; CHECK-NEXT: br label [[F:%.*]] -; CHECK: 2: -; CHECK-NEXT: unreachable -; CHECK: f: -; CHECK-NEXT: ret i32 10 -; CHECK: 3: -; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP7:%.*]], [[TMP3]] ] -; CHECK-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP6:%.*]], [[TMP3]] ] -; CHECK-NEXT: [[TMP6]] = add nuw nsw i32 [[TMP4]], [[TMP5]] -; CHECK-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP4]], 1 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 100 -; CHECK-NEXT: br i1 [[TMP8]], label [[TMP1:%.*]], label [[TMP3]] +; OLD_PM-LABEL: define {{[^@]+}}@r1() local_unnamed_addr +; OLD_PM-NEXT: br label [[TMP4:%.*]] +; OLD_PM: 1: +; OLD_PM-NEXT: [[TMP2:%.*]] = icmp sgt i32 [[TMP7:%.*]], 10000 +; OLD_PM-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[F:%.*]] +; OLD_PM: 3: +; OLD_PM-NEXT: ret i32 20 +; OLD_PM: f: +; OLD_PM-NEXT: ret i32 10 +; OLD_PM: 4: +; OLD_PM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP8:%.*]], [[TMP4]] ] +; OLD_PM-NEXT: [[TMP6:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP7]], [[TMP4]] ] +; OLD_PM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP5]], [[TMP6]] +; OLD_PM-NEXT: [[TMP8]] = add nuw nsw i32 [[TMP5]], 1 +; OLD_PM-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 100 +; OLD_PM-NEXT: br i1 [[TMP9]], label [[TMP1:%.*]], label [[TMP4]] +; +; NEW_PM-LABEL: define {{[^@]+}}@r1() local_unnamed_addr +; NEW_PM-NEXT: br label [[TMP3:%.*]] +; NEW_PM: 1: +; NEW_PM-NEXT: br label [[F:%.*]] +; NEW_PM: 2: +; NEW_PM-NEXT: unreachable +; NEW_PM: f: +; NEW_PM-NEXT: ret i32 10 +; NEW_PM: 3: +; NEW_PM-NEXT: [[TMP4:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[TMP7:%.*]], [[TMP3]] ] +; NEW_PM-NEXT: [[TMP5:%.*]] = phi i32 [ 0, [[TMP0]] ], [ [[TMP6:%.*]], [[TMP3]] ] +; NEW_PM-NEXT: [[TMP6]] = add nuw nsw i32 [[TMP4]], [[TMP5]] +; NEW_PM-NEXT: [[TMP7]] = add nuw nsw i32 [[TMP4]], 1 +; NEW_PM-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 100 +; NEW_PM-NEXT: br i1 [[TMP8]], label [[TMP1:%.*]], label [[TMP3]] ; br label %5 @@ -314,14 +332,25 @@ f: } define void @f1(i32){ -; CHECK-LABEL: define {{[^@]+}}@f1 -; CHECK-SAME: (i32 [[TMP0:%.*]]) -; CHECK-NEXT: [[TMP2:%.*]] = tail call i32 @r1() -; CHECK-NEXT: br label [[TMP4:%.*]] -; CHECK: 3: -; CHECK-NEXT: unreachable -; CHECK: 4: -; CHECK-NEXT: ret void +; OLD_PM-LABEL: define {{[^@]+}}@f1 +; OLD_PM-SAME: (i32 [[TMP0:%.*]]) +; OLD_PM-NEXT: [[TMP2:%.*]] = tail call i32 @r1() +; OLD_PM-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 15 +; OLD_PM-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP5:%.*]] +; OLD_PM: 4: +; OLD_PM-NEXT: tail call void @unkown() +; OLD_PM-NEXT: br label [[TMP5]] +; OLD_PM: 5: +; OLD_PM-NEXT: ret void +; +; NEW_PM-LABEL: define {{[^@]+}}@f1 +; NEW_PM-SAME: (i32 [[TMP0:%.*]]) +; NEW_PM-NEXT: [[TMP2:%.*]] = tail call i32 @r1() +; NEW_PM-NEXT: br label [[TMP4:%.*]] +; NEW_PM: 3: +; NEW_PM-NEXT: unreachable +; NEW_PM: 4: +; NEW_PM-NEXT: ret void ; %2 = tail call i32 @r1(i32 %0) %3 = icmp sgt i32 %2, 15