diff --git a/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll b/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll --- a/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll +++ b/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipconstprop -S | FileCheck %s +; RUN: opt < %s -passes=attributor -S | FileCheck %s ; Should not propagate the result of a weak function. ; PR2411 diff --git a/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll b/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll --- a/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll +++ b/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipsccp -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s ; Don't constant-propagate byval pointers, since they are not pointers! ; PR5038 %struct.MYstr = type { i8, i32 } diff --git a/llvm/test/Transforms/IPConstantProp/PR16052.ll b/llvm/test/Transforms/IPConstantProp/PR16052.ll --- a/llvm/test/Transforms/IPConstantProp/PR16052.ll +++ b/llvm/test/Transforms/IPConstantProp/PR16052.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes ; RUN: opt < %s -S -ipsccp | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s --check-prefix=ATTRIBUTOR target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -10,6 +11,13 @@ ; CHECK-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 undef) ; CHECK-NEXT: ret i64 [[CALL2]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn2() +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: [[CONV:%.*]] = sext i32 undef to i64 +; ATTRIBUTOR-NEXT: [[DIV:%.*]] = sdiv i64 8, [[CONV]] +; ATTRIBUTOR-NEXT: [[CALL2:%.*]] = call i64 @fn1(i64 [[DIV]]) +; ATTRIBUTOR-NEXT: ret i64 [[CALL2]] +; entry: %conv = sext i32 undef to i64 %div = sdiv i64 8, %conv @@ -24,6 +32,13 @@ ; CHECK-NEXT: [[COND:%.*]] = select i1 undef, i64 undef, i64 undef ; CHECK-NEXT: ret i64 [[COND]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn1 +; ATTRIBUTOR-SAME: (i64 returned [[P1:%.*]]) +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: [[TOBOOL:%.*]] = icmp ne i64 [[P1]], 0 +; ATTRIBUTOR-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i64 [[P1]], i64 [[P1]] +; ATTRIBUTOR-NEXT: ret i64 [[COND]] +; entry: %tobool = icmp ne i64 %p1, 0 %cond = select i1 %tobool, i64 %p1, i64 %p1 diff --git a/llvm/test/Transforms/IPConstantProp/PR26044.ll b/llvm/test/Transforms/IPConstantProp/PR26044.ll --- a/llvm/test/Transforms/IPConstantProp/PR26044.ll +++ b/llvm/test/Transforms/IPConstantProp/PR26044.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes -; RUN: opt < %s -S -ipsccp | FileCheck %s --check-prefixes=IPSCCP +; RUN: opt < %s -S -ipsccp | FileCheck %s --check-prefixes=ALL,IPSCCP +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s --check-prefixes=ALL,ATTRIBUTOR target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -15,6 +16,19 @@ ; IPSCCP-NEXT: store i32 [[CALL]], i32* [[P]] ; IPSCCP-NEXT: br label [[FOR_COND1:%.*]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn2 +; ATTRIBUTOR-SAME: (i32* nocapture writeonly [[P:%.*]]) +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: br label [[IF_END:%.*]] +; ATTRIBUTOR: for.cond1: +; ATTRIBUTOR-NEXT: br i1 undef, label [[IF_END]], label [[IF_END]] +; ATTRIBUTOR: if.end: +; ATTRIBUTOR-NEXT: [[E_2:%.*]] = phi i32* [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ], [ null, [[FOR_COND1]] ] +; ATTRIBUTOR-NEXT: [[TMP0:%.*]] = load i32, i32* [[E_2]], align 4 +; ATTRIBUTOR-NEXT: [[CALL:%.*]] = call i32 @fn1(i32 [[TMP0]]) +; ATTRIBUTOR-NEXT: store i32 [[CALL]], i32* [[P]] +; ATTRIBUTOR-NEXT: br label [[FOR_COND1]] +; entry: br label %if.end @@ -36,6 +50,13 @@ ; IPSCCP-NEXT: [[COND:%.*]] = select i1 undef, i32 undef, i32 undef ; IPSCCP-NEXT: ret i32 [[COND]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn1 +; ATTRIBUTOR-SAME: (i32 returned [[P1:%.*]]) +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[P1]], 0 +; ATTRIBUTOR-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]] +; ATTRIBUTOR-NEXT: ret i32 [[COND]] +; entry: %tobool = icmp ne i32 %p1, 0 %cond = select i1 %tobool, i32 %p1, i32 %p1 @@ -55,6 +76,19 @@ ; IPSCCP-NEXT: store i32 [[CALL]], i32* [[P]] ; IPSCCP-NEXT: br label [[FOR_COND1:%.*]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn_no_null_opt +; ATTRIBUTOR-SAME: (i32* nocapture writeonly [[P:%.*]]) +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: br label [[IF_END:%.*]] +; ATTRIBUTOR: for.cond1: +; ATTRIBUTOR-NEXT: br i1 undef, label [[IF_END]], label [[IF_END]] +; ATTRIBUTOR: if.end: +; ATTRIBUTOR-NEXT: [[E_2:%.*]] = phi i32* [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ], [ null, [[FOR_COND1]] ] +; ATTRIBUTOR-NEXT: [[TMP0:%.*]] = load i32, i32* [[E_2]], align 4 +; ATTRIBUTOR-NEXT: [[CALL:%.*]] = call i32 @fn0(i32 [[TMP0]]) +; ATTRIBUTOR-NEXT: store i32 [[CALL]], i32* [[P]] +; ATTRIBUTOR-NEXT: br label [[FOR_COND1]] +; entry: br label %if.end @@ -77,6 +111,13 @@ ; IPSCCP-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]] ; IPSCCP-NEXT: ret i32 [[COND]] ; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@fn0 +; ATTRIBUTOR-SAME: (i32 returned [[P1:%.*]]) +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[P1]], 0 +; ATTRIBUTOR-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], i32 [[P1]], i32 [[P1]] +; ATTRIBUTOR-NEXT: ret i32 [[COND]] +; entry: %tobool = icmp ne i32 %p1, 0 %cond = select i1 %tobool, i32 %p1, i32 %p1 diff --git a/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll b/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll --- a/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll +++ b/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipconstprop -S -o - | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=5 < %s | FileCheck %s ; The original C source looked like this: ; diff --git a/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll b/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll --- a/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll +++ b/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -ipconstprop -S -o - | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s ; This test is just to verify that we do not crash/assert due to mismatch in ; argument type between the caller and callee. diff --git a/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll b/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll --- a/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll +++ b/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipconstprop -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s ; See PR26774 diff --git a/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll b/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll --- a/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll +++ b/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -internalize -ipsccp -S | FileCheck %s +; RUN: opt -S -passes='internalize,attributor' -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s ; PR5569 ; IPSCCP should prove that the blocks are dead and delete them, and diff --git a/llvm/test/Transforms/IPConstantProp/deadarg.ll b/llvm/test/Transforms/IPConstantProp/deadarg.ll --- a/llvm/test/Transforms/IPConstantProp/deadarg.ll +++ b/llvm/test/Transforms/IPConstantProp/deadarg.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipconstprop -disable-output +; RUN: opt -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 -disable-output < %s define internal void @foo(i32 %X) { call void @foo( i32 %X ) ret void diff --git a/llvm/test/Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll b/llvm/test/Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll --- a/llvm/test/Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll +++ b/llvm/test/Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll @@ -1,4 +1,5 @@ ; RUN: opt -S -ipsccp < %s | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s target datalayout = "E-m:e-i64:64-n32:64" target triple = "powerpc64-bgq-linux" diff --git a/llvm/test/Transforms/IPConstantProp/global.ll b/llvm/test/Transforms/IPConstantProp/global.ll --- a/llvm/test/Transforms/IPConstantProp/global.ll +++ b/llvm/test/Transforms/IPConstantProp/global.ll @@ -1,5 +1,6 @@ ; RUN: opt < %s -S -passes=ipsccp | FileCheck %s ; RUN: opt < %s -S -ipsccp | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s --check-prefix=ATTRIBUTOR @_ZL6test1g = internal global i32 42, align 4 @@ -20,6 +21,11 @@ ; CHECK: @_Z7test1f2v() ; CHECK: entry: ; CHECK-NEXT: ret i32 42 + +; ATTRIBUTOR: @_Z7test1f2v() +; ATTRIBUTOR: entry: +; ATTRIBUTOR-NEXT: %tmp = load i32, i32* @_ZL6test1g, align 4 +; ATTRIBUTOR-NEXT: ret i32 %tmp define i32 @_Z7test1f2v() nounwind { entry: %tmp = load i32, i32* @_ZL6test1g, align 4 diff --git a/llvm/test/Transforms/IPConstantProp/musttail-call.ll b/llvm/test/Transforms/IPConstantProp/musttail-call.ll --- a/llvm/test/Transforms/IPConstantProp/musttail-call.ll +++ b/llvm/test/Transforms/IPConstantProp/musttail-call.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipsccp -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=5 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ; PR36485 ; musttail call result can\'t be replaced with a constant, unless the call ; can be removed @@ -11,6 +12,9 @@ true: ; CHECK: %ca = musttail call i8* @side_effects(i8 0) ; CHECK: ret i8* %ca + ; FIXME: propagate the value information for %v + ; ATTRIBUTOR: %ca = musttail call i8* @side_effects(i8 %v) + ; ATTRIBUTOR: ret i8* %ca %ca = musttail call i8* @side_effects(i8 %v) ret i8* %ca false: @@ -19,10 +23,14 @@ c2_true: %ca1 = musttail call i8* @no_side_effects(i8 %v) ; CHECK: ret i8* null + ; FIXME: zap this call + ; ATTRIBUTOR: ret i8* %ca1 ret i8* %ca1 c2_false: ; CHECK: %ca2 = musttail call i8* @dont_zap_me(i8 %v) ; CHECK: ret i8* %ca2 + ; ATTRIBUTOR: %ca2 = musttail call i8* @dont_zap_me(i8 undef) + ; ATTRIBUTOR: ret i8* %ca2 %ca2 = musttail call i8* @dont_zap_me(i8 %v) ret i8* %ca2 } @@ -35,16 +43,19 @@ ; The call can't be removed due to `external` call above, though. ; CHECK: %ca = musttail call i8* @start(i8 0) + ; ATTRIBUTOR: %ca = musttail call i8* @start(i8 %v) %ca = musttail call i8* @start(i8 %v) ; Thus the result must be returned anyway ; CHECK: ret i8* %ca + ; ATTRIBUTOR: ret i8* %ca ret i8* %ca } define internal i8* @no_side_effects(i8 %v) readonly nounwind { ; The call to this function is removed, so the return value must be zapped ; CHECK: ret i8* undef + ; ATTRIBUTOR: ret i8* null ret i8* null } @@ -54,5 +65,6 @@ ; The call to this function cannot be removed due to side effects. Thus the ; return value should stay as it is, and should not be zapped. ; CHECK: ret i8* null + ; ATTRIBUTOR: ret i8* null ret i8* null } diff --git a/llvm/test/Transforms/IPConstantProp/naked-return.ll b/llvm/test/Transforms/IPConstantProp/naked-return.ll --- a/llvm/test/Transforms/IPConstantProp/naked-return.ll +++ b/llvm/test/Transforms/IPConstantProp/naked-return.ll @@ -1,5 +1,6 @@ ; RUN: opt -ipsccp -S %s | FileCheck %s ; RUN: opt -ipconstprop -S %s | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" target triple = "i686-pc-windows-msvc19.0.24215" diff --git a/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll b/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll --- a/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll +++ b/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll @@ -1,4 +1,5 @@ ; RUN: opt -S -ipconstprop < %s | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s ; ; void bar(int, float, double); ; diff --git a/llvm/test/Transforms/IPConstantProp/pthreads.ll b/llvm/test/Transforms/IPConstantProp/pthreads.ll --- a/llvm/test/Transforms/IPConstantProp/pthreads.ll +++ b/llvm/test/Transforms/IPConstantProp/pthreads.ll @@ -1,4 +1,5 @@ ; RUN: opt -ipconstprop -S < %s | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s ; ; #include ; diff --git a/llvm/test/Transforms/IPConstantProp/recursion.ll b/llvm/test/Transforms/IPConstantProp/recursion.ll --- a/llvm/test/Transforms/IPConstantProp/recursion.ll +++ b/llvm/test/Transforms/IPConstantProp/recursion.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -ipconstprop -deadargelim -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=2 < %s | FileCheck %s ; CHECK-NOT: %X diff --git a/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll b/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll --- a/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll +++ b/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -S -ipsccp | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ; PR5596 ; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate @@ -9,6 +10,12 @@ ; CHECK-NOT: call ; CHECK-NEXT: ret i32 123 +; FIXME: Remove obsolete calls/instructions +; ATTRIBUTOR: define i32 @main() #0 { +; ATTRIBUTOR-NEXT: entry: +; ATTRIBUTOR-NEXT: call +; ATTRIBUTOR-NEXT: ret i32 123 + define i32 @main() noreturn nounwind { entry: %call2 = tail call i32 @wwrite(i64 0) nounwind diff --git a/llvm/test/Transforms/IPConstantProp/return-argument.ll b/llvm/test/Transforms/IPConstantProp/return-argument.ll --- a/llvm/test/Transforms/IPConstantProp/return-argument.ll +++ b/llvm/test/Transforms/IPConstantProp/return-argument.ll @@ -1,7 +1,10 @@ ; RUN: opt < %s -ipconstprop -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=10 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ; CHECK: add i32 1, 3 ; CHECK: store i32 %Z, i32* %Q +; ATTRIBUTOR: %Z = add i32 %X1, %X2 +; ATTRIBUTOR: store i32 %Z, i32* %W ;; This function returns its second argument on all return statements define internal i32* @incdec(i1 %C, i32* %V) { diff --git a/llvm/test/Transforms/IPConstantProp/return-constant.ll b/llvm/test/Transforms/IPConstantProp/return-constant.ll --- a/llvm/test/Transforms/IPConstantProp/return-constant.ll +++ b/llvm/test/Transforms/IPConstantProp/return-constant.ll @@ -1,9 +1,14 @@ ; RUN: opt < %s -ipconstprop -instcombine -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=1 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ; CHECK: ret i1 true ; CHECK: ret i1 true ; CHECK-NOT: ret i1 true +; FIXME: icmp folding is missing +; ATTRIBUTOR: ret i1 %Y +; ATTRIBUTOR: ret i1 %Y + define internal i32 @foo(i1 %C) { br i1 %C, label %T, label %F diff --git a/llvm/test/Transforms/IPConstantProp/return-constants.ll b/llvm/test/Transforms/IPConstantProp/return-constants.ll --- a/llvm/test/Transforms/IPConstantProp/return-constants.ll +++ b/llvm/test/Transforms/IPConstantProp/return-constants.ll @@ -1,10 +1,16 @@ ; RUN: opt < %s -ipconstprop -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=7 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ;; Check that the 21 constants got propagated properly ; CHECK: %M = add i32 21, 21 ;; Check that the second return values didn't get propagated ; CHECK: %N = add i32 %B, %D +;; FIXME: support for extractvalue and insertvalue missing. +; ATTRIBUTOR: %M = add i32 %A, %C +;; Check that the second return values didn't get propagated +; ATTRIBUTOR: %N = add i32 %B, %D + %0 = type { i32, i32 } define internal %0 @foo(i1 %Q) { diff --git a/llvm/test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll b/llvm/test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll --- a/llvm/test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll +++ b/llvm/test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll @@ -1,7 +1,12 @@ ; RUN: opt < %s -ipsccp -S | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s --check-prefix=ATTRIBUTOR ; CHECK-LABEL: @testf( ; CHECK: ret i32 undef +; ATTRIBUTOR-LABEL: @testf( +; ATTRIBUTOR-NOT: ret i32 +; ATTRIBUTOR: ret i32 10 +; ATTRIBUTOR-NOT: ret i32 ; define internal i32 @testf(i1 %c) { entry: @@ -19,6 +24,12 @@ ; CHECK-LABEL: @test1( ; CHECK: ret i32 undef +; FIXME: Fold the conditional +; ATTRIBUTOR-LABEL: @test1( +; ATTRIBUTOR: %res = icmp eq i32 10, 10 +; ATTRIBUTOR: br i1 %res, label %ret1, label %ret2 +; ATTRIBUTOR: ret i32 99 +; ATTRIBUTOR: ret i32 0 ; define internal i32 @test1(i1 %c) { entry: @@ -39,6 +50,9 @@ ; CHECK-LABEL: @main( ; CHECK-NEXT: %res = call i32 @test1( ; CHECK-NEXT: ret i32 99 +; ATTRIBUTOR-LABEL: @main( +; ATTRIBUTOR-NEXT: %res = call i32 @test1( +; ATTRIBUTOR-NEXT: ret i32 %res ; define i32 @main(i1 %c) { %res = call i32 @test1(i1 %c) diff --git a/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll b/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll --- a/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll +++ b/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -S -ipsccp | FileCheck %s +; RUN: opt -S -passes=attributor -aa-pipeline='basic-aa' -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=3 < %s | FileCheck %s ; PR5596 ; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate