diff options
Diffstat (limited to 'llvm/test/Transforms/IPConstantProp')
24 files changed, 0 insertions, 1031 deletions
diff --git a/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll b/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll deleted file mode 100644 index 54a65d61da3..00000000000 --- a/llvm/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -ipconstprop -S | grep "ret i32 %r" -; Should not propagate the result of a weak function. -; PR2411 - -define weak i32 @foo() nounwind { -entry: - ret i32 1 -} - -define i32 @main() nounwind { -entry: - %r = call i32 @foo( ) nounwind - ret i32 %r -} - diff --git a/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll b/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll deleted file mode 100644 index 61f4bf6d9f7..00000000000 --- a/llvm/test/Transforms/IPConstantProp/2009-09-24-byval-ptr.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt < %s -ipsccp -S | FileCheck %s -; Don't constant-propagate byval pointers, since they are not pointers! -; PR5038 -%struct.MYstr = type { i8, i32 } -@mystr = internal global %struct.MYstr zeroinitializer ; <%struct.MYstr*> [#uses=3] -define internal void @vfu1(%struct.MYstr* byval align 4 %u) nounwind { -entry: - %0 = getelementptr %struct.MYstr, %struct.MYstr* %u, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 99, i32* %0, align 4 -; CHECK: %struct.MYstr* %u - %1 = getelementptr %struct.MYstr, %struct.MYstr* %u, i32 0, i32 0 ; <i8*> [#uses=1] - store i8 97, i8* %1, align 4 -; CHECK: %struct.MYstr* %u - br label %return - -return: ; preds = %entry - ret void -} - -define internal i32 @vfu2(%struct.MYstr* byval align 4 %u) nounwind readonly { -entry: - %0 = getelementptr %struct.MYstr, %struct.MYstr* %u, i32 0, i32 1 ; <i32*> [#uses=1] - %1 = load i32, i32* %0 -; CHECK: load i32, i32* getelementptr inbounds (%struct.MYstr, %struct.MYstr* @mystr, i32 0, i32 1) - %2 = getelementptr %struct.MYstr, %struct.MYstr* %u, i32 0, i32 0 ; <i8*> [#uses=1] - %3 = load i8, i8* %2 -; CHECK: load i8, i8* getelementptr inbounds (%struct.MYstr, %struct.MYstr* @mystr, i32 0, i32 0) - %4 = zext i8 %3 to i32 - %5 = add i32 %4, %1 - ret i32 %5 -} - -define i32 @unions() nounwind { -entry: - call void @vfu1(%struct.MYstr* byval align 4 @mystr) nounwind - %result = call i32 @vfu2(%struct.MYstr* byval align 4 @mystr) nounwind - - ret i32 %result -} - diff --git a/llvm/test/Transforms/IPConstantProp/PR16052.ll b/llvm/test/Transforms/IPConstantProp/PR16052.ll deleted file mode 100644 index 959074d771f..00000000000 --- a/llvm/test/Transforms/IPConstantProp/PR16052.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt < %s -S -ipsccp | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i64 @fn2() { -entry: - %conv = sext i32 undef to i64 - %div = sdiv i64 8, %conv - %call2 = call i64 @fn1(i64 %div) - ret i64 %call2 -} - -; CHECK-DAG: define i64 @fn2( -; CHECK: %[[CALL:.*]] = call i64 @fn1(i64 undef) - -define internal i64 @fn1(i64 %p1) { -entry: - %tobool = icmp ne i64 %p1, 0 - %cond = select i1 %tobool, i64 %p1, i64 %p1 - ret i64 %cond -} - -; CHECK-DAG: define internal i64 @fn1( -; CHECK: %[[SEL:.*]] = select i1 undef, i64 undef, i64 undef -; CHECK: ret i64 %[[SEL]] diff --git a/llvm/test/Transforms/IPConstantProp/PR26044.ll b/llvm/test/Transforms/IPConstantProp/PR26044.ll deleted file mode 100644 index 6c608868210..00000000000 --- a/llvm/test/Transforms/IPConstantProp/PR26044.ll +++ /dev/null @@ -1,62 +0,0 @@ -; RUN: opt < %s -S -ipsccp | FileCheck %s -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @fn2() { -entry: - br label %if.end - -for.cond1: ; preds = %if.end, %for.end - br i1 undef, label %if.end, label %if.end - -if.end: ; preds = %lbl, %for.cond1 - %e.2 = phi i32* [ undef, %entry ], [ null, %for.cond1 ], [ null, %for.cond1 ] - %0 = load i32, i32* %e.2, align 4 - %call = call i32 @fn1(i32 %0) - br label %for.cond1 -} - -define internal i32 @fn1(i32 %p1) { -entry: - %tobool = icmp ne i32 %p1, 0 - %cond = select i1 %tobool, i32 %p1, i32 %p1 - ret i32 %cond -} - -define void @fn_no_null_opt() #0 { -entry: - br label %if.end - -for.cond1: ; preds = %if.end, %for.end - br i1 undef, label %if.end, label %if.end - -if.end: ; preds = %lbl, %for.cond1 - %e.2 = phi i32* [ undef, %entry ], [ null, %for.cond1 ], [ null, %for.cond1 ] - %0 = load i32, i32* %e.2, align 4 - %call = call i32 @fn0(i32 %0) - br label %for.cond1 -} - -define internal i32 @fn0(i32 %p1) { -entry: - %tobool = icmp ne i32 %p1, 0 - %cond = select i1 %tobool, i32 %p1, i32 %p1 - ret i32 %cond -} - -attributes #0 = { "null-pointer-is-valid"="true" } - -; CHECK-LABEL: define void @fn2( -; CHECK: call i32 @fn1(i32 undef) - -; CHECK-LABEL: define internal i32 @fn1( -; CHECK:%[[COND:.*]] = select i1 undef, i32 undef, i32 undef -; CHECK: ret i32 %[[COND]] - -; CHECK-LABEL: define void @fn_no_null_opt( -; CHECK: call i32 @fn0(i32 %0) - -; CHECK-LABEL: define internal i32 @fn0( -; CHECK:%[[TOBOOL:.*]] = icmp ne i32 %p1, 0 -; CHECK:%[[COND:.*]] = select i1 %[[TOBOOL]], i32 %p1, i32 %p1 -; CHECK: ret i32 %[[COND]] diff --git a/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll b/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll deleted file mode 100644 index 1f62f646509..00000000000 --- a/llvm/test/Transforms/IPConstantProp/arg-count-mismatch.ll +++ /dev/null @@ -1,72 +0,0 @@ -; RUN: opt < %s -ipconstprop -S -o - | FileCheck %s - -; The original C source looked like this: -; -; long long a101, b101, e101; -; volatile long c101; -; int d101; -; -; static inline int bar(p1, p2) -; { -; return 0; -; } -; -; void foo(unsigned p1) -; { -; long long *f = &b101, *g = &e101; -; c101 = 0; -; (void)((*f |= a101) - (*g = bar(d101))); -; c101 = (*f |= a101 &= p1) == d101; -; } -; -; When compiled with Clang it gives a warning -; warning: too few arguments in call to 'bar' -; -; This ll reproducer has been reduced to only include tha call. -; -; Note that -lint will report this as UB, but it passes -verify. - -; This test is just to verify that we do not crash/assert due to mismatch in -; argument count between the caller and callee. - -define dso_local void @foo(i16 %a) { -; CHECK-LABEL: @foo( -; CHECK-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar to i16 (i16)*)(i16 [[A:%.*]]) -; CHECK-NEXT: ret void -; - %call = call i16 bitcast (i16 (i16, i16) * @bar to i16 (i16) *)(i16 %a) - ret void -} - -define internal i16 @bar(i16 %p1, i16 %p2) { -; CHECK-LABEL: @bar( -; CHECK-NEXT: ret i16 0 -; - ret i16 0 -} - -;------------------------------------------------------------------------------- -; Additional tests to verify that we still optimize when having a mismatch -; in argument count due to varargs (as long as all non-variadic arguments have -; been provided), - -define dso_local void @vararg_tests(i16 %a) { - %call1 = call i16 (i16, ...) @vararg_prop(i16 7, i16 8, i16 %a) - %call2 = call i16 bitcast (i16 (i16, i16, ...) * @vararg_no_prop to i16 (i16) *) (i16 7) - ret void -} - -define internal i16 @vararg_prop(i16 %p1, ...) { -; CHECK-LABEL: define internal i16 @vararg_prop( -; CHECK-NEXT: ret i16 7 -; - ret i16 %p1 -} - -define internal i16 @vararg_no_prop(i16 %p1, i16 %p2, ...) { -; CHECK-LABEL: define internal i16 @vararg_no_prop( -; CHECK-NEXT: ret i16 [[P1:%.*]] -; - ret i16 %p1 -} - diff --git a/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll b/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll deleted file mode 100644 index ff924d73390..00000000000 --- a/llvm/test/Transforms/IPConstantProp/arg-type-mismatch.ll +++ /dev/null @@ -1,23 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -ipconstprop -S -o - | 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. - -define dso_local void @foo(i16 %a) { -; CHECK-LABEL: @foo( -; CHECK-NEXT: [[CALL:%.*]] = call i16 bitcast (i16 (i16, i16)* @bar to i16 (i16, i32)*)(i16 [[A:%.*]], i32 7) -; CHECK-NEXT: ret void -; - %call = call i16 bitcast (i16 (i16, i16) * @bar to i16 (i16, i32) *)(i16 %a, i32 7) - ret void -} - -define internal i16 @bar(i16 %p1, i16 %p2) { -; CHECK-LABEL: @bar( -; CHECK-NEXT: ret i16 [[P2:%.*]] -; - ret i16 %p2 -} - - diff --git a/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll b/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll deleted file mode 100644 index 6c4c44c33e2..00000000000 --- a/llvm/test/Transforms/IPConstantProp/comdat-ipo.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -ipconstprop -S | FileCheck %s - -; See PR26774 - -define i32 @baz() { - ret i32 10 -} - -; We can const-prop @baz's return value *into* @foo, but cannot -; constprop @foo's return value into bar. - -define linkonce_odr i32 @foo() { -; CHECK-LABEL: @foo( -; CHECK-NEXT: %val = call i32 @baz() -; CHECK-NEXT: ret i32 10 - - %val = call i32 @baz() - ret i32 %val -} - -define i32 @bar() { -; CHECK-LABEL: @bar( -; CHECK-NEXT: %val = call i32 @foo() -; CHECK-NEXT: ret i32 %val - - %val = call i32 @foo() - ret i32 %val -} diff --git a/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll b/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll deleted file mode 100644 index abd0b0fc313..00000000000 --- a/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt < %s -internalize -ipsccp -S | FileCheck %s -; PR5569 - -; IPSCCP should prove that the blocks are dead and delete them, and -; properly handle the dangling blockaddress constants. - -; CHECK: @bar.l = internal constant [2 x i8*] [i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 1 to i8*)] - -@code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 4 ; <[5 x i32]*> [#uses=0] -@bar.l = internal constant [2 x i8*] [i8* blockaddress(@bar, %lab0), i8* blockaddress(@bar, %end)] ; <[2 x i8*]*> [#uses=1] - -define void @foo(i32 %x) nounwind readnone { -entry: - %b = alloca i32, align 4 ; <i32*> [#uses=1] - store volatile i32 -1, i32* %b - ret void -} - -define void @bar(i32* nocapture %pc) nounwind readonly { -entry: - br label %indirectgoto - -lab0: ; preds = %indirectgoto - %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] - br label %indirectgoto - -end: ; preds = %indirectgoto - ret void - -indirectgoto: ; preds = %lab0, %entry - %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2] - %pc.addr.0 = getelementptr i32, i32* %pc, i32 %indvar ; <i32*> [#uses=1] - %tmp1.pn = load i32, i32* %pc.addr.0 ; <i32> [#uses=1] - %indirect.goto.dest.in = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i32 0, i32 %tmp1.pn ; <i8**> [#uses=1] - %indirect.goto.dest = load i8*, i8** %indirect.goto.dest.in ; <i8*> [#uses=1] - indirectbr i8* %indirect.goto.dest, [label %lab0, label %end] -} - -define i32 @main() nounwind readnone { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/IPConstantProp/deadarg.ll b/llvm/test/Transforms/IPConstantProp/deadarg.ll deleted file mode 100644 index 4b9938e09e9..00000000000 --- a/llvm/test/Transforms/IPConstantProp/deadarg.ll +++ /dev/null @@ -1,6 +0,0 @@ -; RUN: opt < %s -ipconstprop -disable-output -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 deleted file mode 100644 index 8f97225ca44..00000000000 --- a/llvm/test/Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt -S -ipsccp < %s | FileCheck %s -target datalayout = "E-m:e-i64:64-n32:64" -target triple = "powerpc64-bgq-linux" - -define void @test(i32 signext %n) { - -; CHECK-LABEL: @test - -entry: - br i1 undef, label %if.then, label %if.end - -if.then: ; preds = %entry - ret void - -if.end: ; preds = %entry - br i1 undef, label %if.then2, label %if.end4 - -if.then2: ; preds = %if.end - unreachable - -if.end4: ; preds = %if.end - %sub.n = select i1 undef, i32 undef, i32 %n - switch i32 %sub.n, label %if.else14 [ - i32 0, label %if.then9 - i32 1, label %if.then12 - ] - -if.then9: ; preds = %if.end4 - unreachable - -if.then12: ; preds = %if.end4 - unreachable - -if.else14: ; preds = %if.end4 - br label %do.body - -do.body: ; preds = %do.body, %if.else14 - %scale.0 = phi ppc_fp128 [ 0xM3FF00000000000000000000000000000, %if.else14 ], [ %scale.0, %do.body ] - br i1 undef, label %do.body, label %if.then33 - -if.then33: ; preds = %do.body - br i1 undef, label %_ZN5boost4math4signIgEEiRKT_.exit30, label %cond.false.i28 - -cond.false.i28: ; preds = %if.then33 - %0 = bitcast ppc_fp128 %scale.0 to i128 - %tobool.i26 = icmp slt i128 %0, 0 - br label %_ZN5boost4math4signIgEEiRKT_.exit30 - -_ZN5boost4math4signIgEEiRKT_.exit30: ; preds = %cond.false.i28, %if.then33 - unreachable -} - diff --git a/llvm/test/Transforms/IPConstantProp/global.ll b/llvm/test/Transforms/IPConstantProp/global.ll deleted file mode 100644 index 5e34696d566..00000000000 --- a/llvm/test/Transforms/IPConstantProp/global.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -S -passes=ipsccp | FileCheck %s -; RUN: opt < %s -S -ipsccp | FileCheck %s - -@_ZL6test1g = internal global i32 42, align 4 - -define void @_Z7test1f1v() nounwind { -entry: - %tmp = load i32, i32* @_ZL6test1g, align 4 - %cmp = icmp eq i32 %tmp, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: ; preds = %entry - store i32 0, i32* @_ZL6test1g, align 4 - br label %if.end - -if.end: ; preds = %if.then, %entry - ret void -} - -; CHECK: @_Z7test1f2v() -; CHECK: entry: -; CHECK-NEXT: ret i32 42 -define i32 @_Z7test1f2v() nounwind { -entry: - %tmp = load i32, i32* @_ZL6test1g, align 4 - ret i32 %tmp -} diff --git a/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll b/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll deleted file mode 100644 index 3288b5b94de..00000000000 --- a/llvm/test/Transforms/IPConstantProp/multiple_callbacks.ll +++ /dev/null @@ -1,87 +0,0 @@ -; RUN: opt -ipconstprop -S < %s | FileCheck %s -; -; -; /---------------------------------------| -; | /----------------------|----| -; | | /-----| | -; V V V | | -; void broker(int (*cb0)(int), int (*cb1)(int), int (*cb2)(int), int, int); -; -; static int cb0(int zero) { -; return zero; -; } -; static int cb1(int unknown) { -; return unknown; -; } -; static int cb2(int unknown) { -; cb0(0); -; return unknown; -; } -; static int cb3(int unknown) { -; return unknown; -; } -; static int cb4(int unknown) { -; return unknown; -; } -; -; void foo() { -; cb0(0); -; cb3(1); -; broker(cb0, cb1, cb0, 0, 1); -; broker(cb1, cb2, cb2, 0, 1); -; broker(cb3, cb2, cb3, 0, 1); -; broker(cb4, cb4, cb4, 0, 1); -; } -; -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -define internal i32 @cb0(i32 %zero) { -entry: -; CHECK: @cb0 -; CHECK-NEXT: entry -; CHECK-NEXT: ret i32 0 - ret i32 %zero -} - -define internal i32 @cb1(i32 %unknown) { -entry: -; CHECK: ret i32 %unknown - ret i32 %unknown -} - -define internal i32 @cb2(i32 %unknown) { -entry: - %call = call i32 @cb0(i32 0) -; CHECK: ret i32 %unknown - ret i32 %unknown -} - -define internal i32 @cb3(i32 %unknown) { -entry: -; CHECK: ret i32 %unknown - ret i32 %unknown -} - -define internal i32 @cb4(i32 %unknown) { -entry: -; CHECK: ret i32 %unknown - ret i32 %unknown -} - -define void @foo() { -entry: - %call = call i32 @cb0(i32 0) - %call1 = call i32 @cb3(i32 1) - call void @broker(i32 (i32)* nonnull @cb0, i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb0, i32 0, i32 1) - call void @broker(i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb2, i32 0, i32 1) - call void @broker(i32 (i32)* nonnull @cb3, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb3, i32 0, i32 1) - call void @broker(i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 0, i32 1) - ret void -} - -declare !callback !3 void @broker(i32 (i32)*, i32 (i32)*, i32 (i32)*, i32, i32) - -!0 = !{i64 0, i64 3, i1 false} -!1 = !{i64 1, i64 4, i1 false} -!2 = !{i64 2, i64 3, i1 false} -!3 = !{!0, !2, !1} diff --git a/llvm/test/Transforms/IPConstantProp/musttail-call.ll b/llvm/test/Transforms/IPConstantProp/musttail-call.ll deleted file mode 100644 index 567ca408099..00000000000 --- a/llvm/test/Transforms/IPConstantProp/musttail-call.ll +++ /dev/null @@ -1,58 +0,0 @@ -; RUN: opt < %s -ipsccp -S | FileCheck %s -; PR36485 -; musttail call result can\'t be replaced with a constant, unless the call -; can be removed - -declare i32 @external() - -define i8* @start(i8 %v) { - %c1 = icmp eq i8 %v, 0 - br i1 %c1, label %true, label %false -true: - ; CHECK: %ca = musttail call i8* @side_effects(i8 0) - ; CHECK: ret i8* %ca - %ca = musttail call i8* @side_effects(i8 %v) - ret i8* %ca -false: - %c2 = icmp eq i8 %v, 1 - br i1 %c2, label %c2_true, label %c2_false -c2_true: - %ca1 = musttail call i8* @no_side_effects(i8 %v) - ; CHECK: ret i8* null - ret i8* %ca1 -c2_false: - ; CHECK: %ca2 = musttail call i8* @dont_zap_me(i8 %v) - ; CHECK: ret i8* %ca2 - %ca2 = musttail call i8* @dont_zap_me(i8 %v) - ret i8* %ca2 -} - -define internal i8* @side_effects(i8 %v) { - %i1 = call i32 @external() - - ; since this goes back to `start` the SCPP should be see that the return value - ; is always `null`. - ; The call can't be removed due to `external` call above, though. - - ; CHECK: %ca = musttail call i8* @start(i8 0) - %ca = musttail call i8* @start(i8 %v) - - ; Thus the result must be returned anyway - ; CHECK: 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 - ret i8* null -} - -define internal i8* @dont_zap_me(i8 %v) { - %i1 = call i32 @external() - - ; 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 - ret i8* null -} diff --git a/llvm/test/Transforms/IPConstantProp/naked-return.ll b/llvm/test/Transforms/IPConstantProp/naked-return.ll deleted file mode 100644 index 3a2dedafcd3..00000000000 --- a/llvm/test/Transforms/IPConstantProp/naked-return.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt -ipsccp -S %s | FileCheck %s -; RUN: opt -ipconstprop -S %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" - -define i32 @dipsy(i32, i32) local_unnamed_addr #0 { -BasicBlock0: - call void asm "\0D\0Apushl %ebp\0D\0Amovl 8(%esp),%eax\0D\0Amovl 12(%esp), %ebp\0D\0Acalll *%eax\0D\0Apopl %ebp\0D\0Aretl\0D\0A", ""() - ret i32 0 -} - -define void @tinkywinky(i32, i32, i32) local_unnamed_addr #0 { -BasicBlock1: - call void asm "\0D\0A movl 12(%esp), %ebp\0D\0A movl 4(%esp), %eax\0D\0A movl 8(%esp), %esp\0D\0A jmpl *%eax\0D\0A", ""() - ret void -} - -define void @patatino(i32, i32, i32) local_unnamed_addr #1 { -bb: - %3 = tail call i32 @dipsy(i32 %0, i32 %1) #0 -; Check that we don't accidentally propagate zero. -; CHECK: @tinkywinky(i32 %3, i32 %2, i32 %1) #0 - tail call void @tinkywinky(i32 %3, i32 %2, i32 %1) #0 - ret void -} - -attributes #0 = { naked } -attributes #1 = { "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" } diff --git a/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll b/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll deleted file mode 100644 index 3c7ffe27f5d..00000000000 --- a/llvm/test/Transforms/IPConstantProp/openmp_parallel_for.ll +++ /dev/null @@ -1,120 +0,0 @@ -; RUN: opt -S -ipconstprop < %s | FileCheck %s -; -; void bar(int, float, double); -; -; void foo(int N) { -; float p = 3; -; double q = 5; -; N = 7; -; -; #pragma omp parallel for firstprivate(q) -; for (int i = 2; i < N; i++) { -; bar(i, p, q); -; } -; } -; -; Verify the constant value of q is propagated into the outlined function. -; -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -%struct.ident_t = type { i32, i32, i32, i32, i8* } - -@.str = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1 -@0 = private unnamed_addr global %struct.ident_t { i32 0, i32 514, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32 0) }, align 8 -@1 = private unnamed_addr global %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i32 0, i32 0) }, align 8 - -define dso_local void @foo(i32 %N) { -entry: - %N.addr = alloca i32, align 4 - %p = alloca float, align 4 - store i32 %N, i32* %N.addr, align 4 - store float 3.000000e+00, float* %p, align 4 - store i32 7, i32* %N.addr, align 4 - call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* nonnull @1, i32 3, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*, float*, i64)* @.omp_outlined. to void (i32*, i32*, ...)*), i32* nonnull %N.addr, float* nonnull %p, i64 4617315517961601024) - ret void -} - -define internal void @.omp_outlined.(i32* noalias %.global_tid., i32* noalias %.bound_tid., i32* dereferenceable(4) %N, float* dereferenceable(4) %p, i64 %q) { -entry: - %q.addr = alloca i64, align 8 - %.omp.lb = alloca i32, align 4 - %.omp.ub = alloca i32, align 4 - %.omp.stride = alloca i32, align 4 - %.omp.is_last = alloca i32, align 4 -; CHECK: store i64 4617315517961601024, i64* %q.addr, align 8 - store i64 %q, i64* %q.addr, align 8 - %conv = bitcast i64* %q.addr to double* - %tmp = load i32, i32* %N, align 4 - %sub3 = add nsw i32 %tmp, -3 - %cmp = icmp sgt i32 %tmp, 2 - br i1 %cmp, label %omp.precond.then, label %omp.precond.end - -omp.precond.then: ; preds = %entry - store i32 0, i32* %.omp.lb, align 4 - store i32 %sub3, i32* %.omp.ub, align 4 - store i32 1, i32* %.omp.stride, align 4 - store i32 0, i32* %.omp.is_last, align 4 - %tmp5 = load i32, i32* %.global_tid., align 4 - call void @__kmpc_for_static_init_4(%struct.ident_t* nonnull @0, i32 %tmp5, i32 34, i32* nonnull %.omp.is_last, i32* nonnull %.omp.lb, i32* nonnull %.omp.ub, i32* nonnull %.omp.stride, i32 1, i32 1) - %tmp6 = load i32, i32* %.omp.ub, align 4 - %cmp6 = icmp sgt i32 %tmp6, %sub3 - br i1 %cmp6, label %cond.true, label %cond.false - -cond.true: ; preds = %omp.precond.then - br label %cond.end - -cond.false: ; preds = %omp.precond.then - %tmp7 = load i32, i32* %.omp.ub, align 4 - br label %cond.end - -cond.end: ; preds = %cond.false, %cond.true - %cond = phi i32 [ %sub3, %cond.true ], [ %tmp7, %cond.false ] - store i32 %cond, i32* %.omp.ub, align 4 - %tmp8 = load i32, i32* %.omp.lb, align 4 - br label %omp.inner.for.cond - -omp.inner.for.cond: ; preds = %omp.inner.for.inc, %cond.end - %.omp.iv.0 = phi i32 [ %tmp8, %cond.end ], [ %add11, %omp.inner.for.inc ] - %tmp9 = load i32, i32* %.omp.ub, align 4 - %cmp8 = icmp sgt i32 %.omp.iv.0, %tmp9 - br i1 %cmp8, label %omp.inner.for.cond.cleanup, label %omp.inner.for.body - -omp.inner.for.cond.cleanup: ; preds = %omp.inner.for.cond - br label %omp.inner.for.end - -omp.inner.for.body: ; preds = %omp.inner.for.cond - %add10 = add nsw i32 %.omp.iv.0, 2 - %tmp10 = load float, float* %p, align 4 - %tmp11 = load double, double* %conv, align 8 - call void @bar(i32 %add10, float %tmp10, double %tmp11) - br label %omp.body.continue - -omp.body.continue: ; preds = %omp.inner.for.body - br label %omp.inner.for.inc - -omp.inner.for.inc: ; preds = %omp.body.continue - %add11 = add nsw i32 %.omp.iv.0, 1 - br label %omp.inner.for.cond - -omp.inner.for.end: ; preds = %omp.inner.for.cond.cleanup - br label %omp.loop.exit - -omp.loop.exit: ; preds = %omp.inner.for.end - %tmp12 = load i32, i32* %.global_tid., align 4 - call void @__kmpc_for_static_fini(%struct.ident_t* nonnull @0, i32 %tmp12) - br label %omp.precond.end - -omp.precond.end: ; preds = %omp.loop.exit, %entry - ret void -} - -declare dso_local void @__kmpc_for_static_init_4(%struct.ident_t*, i32, i32, i32*, i32*, i32*, i32*, i32, i32) - -declare dso_local void @bar(i32, float, double) - -declare dso_local void @__kmpc_for_static_fini(%struct.ident_t*, i32) - -declare !callback !0 dso_local void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) - -!1 = !{i64 2, i64 -1, i64 -1, i1 true} -!0 = !{!1} diff --git a/llvm/test/Transforms/IPConstantProp/pthreads.ll b/llvm/test/Transforms/IPConstantProp/pthreads.ll deleted file mode 100644 index 0af2c166a08..00000000000 --- a/llvm/test/Transforms/IPConstantProp/pthreads.ll +++ /dev/null @@ -1,49 +0,0 @@ -; RUN: opt -ipconstprop -S < %s | FileCheck %s -; -; #include <pthread.h> -; -; void *GlobalVPtr; -; -; static void *foo(void *arg) { return arg; } -; static void *bar(void *arg) { return arg; } -; -; int main() { -; pthread_t thread; -; pthread_create(&thread, NULL, foo, NULL); -; pthread_create(&thread, NULL, bar, &GlobalVPtr); -; return 0; -; } -; -; Verify the constant values NULL and &GlobalVPtr are propagated into foo and -; bar, respectively. -; -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -%union.pthread_attr_t = type { i64, [48 x i8] } - -@GlobalVPtr = common dso_local global i8* null, align 8 - -define dso_local i32 @main() { -entry: - %thread = alloca i64, align 8 - %call = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @foo, i8* null) - %call1 = call i32 @pthread_create(i64* nonnull %thread, %union.pthread_attr_t* null, i8* (i8*)* nonnull @bar, i8* bitcast (i8** @GlobalVPtr to i8*)) - ret i32 0 -} - -declare !callback !0 dso_local i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*) - -define internal i8* @foo(i8* %arg) { -entry: -; CHECK: ret i8* null - ret i8* %arg -} - -define internal i8* @bar(i8* %arg) { -entry: -; CHECK: ret i8* bitcast (i8** @GlobalVPtr to i8*) - ret i8* %arg -} - -!1 = !{i64 2, i64 3, i1 false} -!0 = !{!1} diff --git a/llvm/test/Transforms/IPConstantProp/recursion.ll b/llvm/test/Transforms/IPConstantProp/recursion.ll deleted file mode 100644 index b25a6c08181..00000000000 --- a/llvm/test/Transforms/IPConstantProp/recursion.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: opt < %s -ipconstprop -deadargelim -S | not grep %X -define internal i32 @foo(i32 %X) { - %Y = call i32 @foo( i32 %X ) ; <i32> [#uses=1] - %Z = add i32 %Y, 1 ; <i32> [#uses=1] - ret i32 %Z -} - -define void @bar() { - call i32 @foo( i32 17 ) ; <i32>:1 [#uses=0] - ret void -} - diff --git a/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll b/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll deleted file mode 100644 index 943086ab466..00000000000 --- a/llvm/test/Transforms/IPConstantProp/remove-call-inst.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: opt < %s -S -ipsccp | FileCheck %s -; PR5596 - -; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate -; the result. - -; CHECK: define i32 @main() #0 { -; CHECK-NEXT: entry: -; CHECK-NOT: call -; CHECK-NEXT: ret i32 123 - -define i32 @main() noreturn nounwind { -entry: - %call2 = tail call i32 @wwrite(i64 0) nounwind - ret i32 %call2 -} - -define internal i32 @wwrite(i64 %i) nounwind readnone { -entry: - switch i64 %i, label %sw.default [ - i64 3, label %return - i64 10, label %return - ] - -sw.default: - ret i32 123 - -return: - ret i32 0 -} - -; CHECK: attributes #0 = { noreturn nounwind } -; CHECK: attributes #1 = { nounwind readnone } diff --git a/llvm/test/Transforms/IPConstantProp/return-argument.ll b/llvm/test/Transforms/IPConstantProp/return-argument.ll deleted file mode 100644 index 0290adc4b78..00000000000 --- a/llvm/test/Transforms/IPConstantProp/return-argument.ll +++ /dev/null @@ -1,57 +0,0 @@ -; RUN: opt < %s -ipconstprop -S > %t -; RUN: cat %t | grep "store i32 %Z, i32\* %Q" -; RUN: cat %t | grep "add i32 1, 3" - -;; This function returns its second argument on all return statements -define internal i32* @incdec(i1 %C, i32* %V) { - %X = load i32, i32* %V - br i1 %C, label %T, label %F - -T: ; preds = %0 - %X1 = add i32 %X, 1 - store i32 %X1, i32* %V - ret i32* %V - -F: ; preds = %0 - %X2 = sub i32 %X, 1 - store i32 %X2, i32* %V - ret i32* %V -} - -;; This function returns its first argument as a part of a multiple return -;; value -define internal { i32, i32 } @foo(i32 %A, i32 %B) { - %X = add i32 %A, %B - %Y = insertvalue { i32, i32 } undef, i32 %A, 0 - %Z = insertvalue { i32, i32 } %Y, i32 %X, 1 - ret { i32, i32 } %Z -} - -define void @caller(i1 %C) personality i32 (...)* @__gxx_personality_v0 { - %Q = alloca i32 - ;; Call incdec to see if %W is properly replaced by %Q - %W = call i32* @incdec(i1 %C, i32* %Q ) ; <i32> [#uses=1] - ;; Call @foo twice, to prevent the arguments from propagating into the - ;; function (so we can check the returned argument is properly - ;; propagated per-caller). - %S1 = call { i32, i32 } @foo(i32 1, i32 2) - %X1 = extractvalue { i32, i32 } %S1, 0 - %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %LPAD - -OK: - %X2 = extractvalue { i32, i32 } %S2, 0 - ;; Do some stuff with the returned values which we can grep for - %Z = add i32 %X1, %X2 - store i32 %Z, i32* %W - br label %RET - -LPAD: - %exn = landingpad {i8*, i32} - cleanup - br label %RET - -RET: - ret void -} - -declare i32 @__gxx_personality_v0(...) diff --git a/llvm/test/Transforms/IPConstantProp/return-constant.ll b/llvm/test/Transforms/IPConstantProp/return-constant.ll deleted file mode 100644 index 195420d6aad..00000000000 --- a/llvm/test/Transforms/IPConstantProp/return-constant.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: opt < %s -ipconstprop -instcombine -S | grep "ret i1 true" | count 2 -define internal i32 @foo(i1 %C) { - br i1 %C, label %T, label %F - -T: ; preds = %0 - ret i32 52 - -F: ; preds = %0 - ret i32 52 -} - -define i1 @caller(i1 %C) { - %X = call i32 @foo( i1 %C ) ; <i32> [#uses=1] - %Y = icmp ne i32 %X, 0 ; <i1> [#uses=1] - ret i1 %Y -} - -define i1 @invokecaller(i1 %C) personality i32 (...)* @__gxx_personality_v0 { - %X = invoke i32 @foo( i1 %C ) to label %OK unwind label %FAIL ; <i32> [#uses=1] -OK: - %Y = icmp ne i32 %X, 0 ; <i1> [#uses=1] - ret i1 %Y -FAIL: - %exn = landingpad {i8*, i32} - cleanup - ret i1 false -} - -declare i32 @__gxx_personality_v0(...) diff --git a/llvm/test/Transforms/IPConstantProp/return-constants.ll b/llvm/test/Transforms/IPConstantProp/return-constants.ll deleted file mode 100644 index be2ca71c55c..00000000000 --- a/llvm/test/Transforms/IPConstantProp/return-constants.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -ipconstprop -S > %t -;; Check that the 21 constants got propagated properly -; RUN: cat %t | grep "%M = add i32 21, 21" -;; Check that the second return values didn't get propagated -; RUN: cat %t | grep "%N = add i32 %B, %D" - -%0 = type { i32, i32 } - -define internal %0 @foo(i1 %Q) { - br i1 %Q, label %T, label %F - -T: ; preds = %0 - %mrv = insertvalue %0 undef, i32 21, 0 - %mrv1 = insertvalue %0 %mrv, i32 22, 1 - ret %0 %mrv1 - -F: ; preds = %0 - %mrv2 = insertvalue %0 undef, i32 21, 0 - %mrv3 = insertvalue %0 %mrv2, i32 23, 1 - ret %0 %mrv3 -} - -define internal %0 @bar(i1 %Q) { - %A = insertvalue %0 undef, i32 21, 0 - br i1 %Q, label %T, label %F - -T: ; preds = %0 - %B = insertvalue %0 %A, i32 22, 1 - ret %0 %B - -F: ; preds = %0 - %C = insertvalue %0 %A, i32 23, 1 - ret %0 %C -} - -define %0 @caller(i1 %Q) { - %X = call %0 @foo(i1 %Q) - %A = extractvalue %0 %X, 0 - %B = extractvalue %0 %X, 1 - %Y = call %0 @bar(i1 %Q) - %C = extractvalue %0 %Y, 0 - %D = extractvalue %0 %Y, 1 - %M = add i32 %A, %C - %N = add i32 %B, %D - ret %0 %X -} 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 deleted file mode 100644 index 5e7c323641d..00000000000 --- a/llvm/test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll +++ /dev/null @@ -1,43 +0,0 @@ -; RUN: opt < %s -ipsccp -S | FileCheck %s - -; CHECK-LABEL: @testf( -; CHECK: ret i32 undef -; -define internal i32 @testf() { -entry: - br i1 undef, label %if.then, label %if.end - -if.then: ; preds = %entry, %if.then - br label %if.end - -if.end: ; preds = %if.then1, %entry - ret i32 10 -} - -; CHECK-LABEL: @test1( -; CHECK: ret i32 undef -; -define internal i32 @test1() { -entry: - br label %if.then - -if.then: ; preds = %entry, %if.then - %call = call i32 @testf() - %res = icmp eq i32 %call, 10 - br i1 %res, label %ret1, label %ret2 - -ret1: ; preds = %if.then, %entry - ret i32 99 - -ret2: ; preds = %if.then, %entry - ret i32 0 -} - -; CHECK-LABEL: @main( -; CHECK-NEXT: %res = call i32 @test1() -; CHECK-NEXT: ret i32 99 -; -define i32 @main() { - %res = call i32 @test1() - ret i32 %res -} diff --git a/llvm/test/Transforms/IPConstantProp/thread_local_acs.ll b/llvm/test/Transforms/IPConstantProp/thread_local_acs.ll deleted file mode 100644 index 0595a5ca7f1..00000000000 --- a/llvm/test/Transforms/IPConstantProp/thread_local_acs.ll +++ /dev/null @@ -1,42 +0,0 @@ -; RUN: opt -ipconstprop -S < %s | FileCheck %s -; -; #include <threads.h> -; thread_local int gtl = 0; -; int gsh = 0; -; -; static int callee(int *thread_local_ptr, int *shared_ptr) { -; return *thread_local_ptr + *shared_ptr; -; } -; -; void broker(int *, int (*callee)(int *, int *), int *); -; -; void caller() { -; broker(>l, callee, &gsh); -; } -; -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - -@gtl = dso_local thread_local global i32 0, align 4 -@gsh = dso_local global i32 0, align 4 - -define internal i32 @callee(i32* %thread_local_ptr, i32* %shared_ptr) { -entry: -; CHECK: %tmp = load i32, i32* %thread_local_ptr, align 4 -; CHECK: %tmp1 = load i32, i32* @gsh, align 4 -; CHECK: %add = add nsw i32 %tmp, %tmp1 - %tmp = load i32, i32* %thread_local_ptr, align 4 - %tmp1 = load i32, i32* %shared_ptr, align 4 - %add = add nsw i32 %tmp, %tmp1 - ret i32 %add -} - -define dso_local void @caller() { -entry: - call void @broker(i32* nonnull @gtl, i32 (i32*, i32*)* nonnull @callee, i32* nonnull @gsh) - ret void -} - -declare !callback !0 dso_local void @broker(i32*, i32 (i32*, i32*)*, i32*) - -!1 = !{i64 1, i64 0, i64 2, i1 false} -!0 = !{!1} diff --git a/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll b/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll deleted file mode 100644 index 3146709aec6..00000000000 --- a/llvm/test/Transforms/IPConstantProp/user-with-multiple-uses.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: opt < %s -S -ipsccp | FileCheck %s -; PR5596 - -; IPSCCP should propagate the 0 argument, eliminate the switch, and propagate -; the result. - -; CHECK: define i32 @main() #0 { -; CHECK-NEXT: entry: -; CHECK-NEXT: %call2 = tail call i32 @wwrite(i64 0) [[NUW:#[0-9]+]] -; CHECK-NEXT: ret i32 123 - -define i32 @main() noreturn nounwind { -entry: - %call2 = tail call i32 @wwrite(i64 0) nounwind - ret i32 %call2 -} - -define internal i32 @wwrite(i64 %i) nounwind { -entry: - switch i64 %i, label %sw.default [ - i64 3, label %return - i64 10, label %return - ] - -sw.default: - ret i32 123 - -return: - ret i32 0 -} - -; CHECK: attributes #0 = { noreturn nounwind } -; CHECK: attributes #1 = { nounwind } |