diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-14 17:57:32 +0000 |
commit | 59850d0874429601812bc13408cb1f776649027c (patch) | |
tree | b21f6de4e08b89bb7931806bab798fc2a5e3a686 /test/Transforms/InstCombine | |
parent | 18f153bdb9db52e7089a2d5293b96c45a3124a26 (diff) |
Notes
Diffstat (limited to 'test/Transforms/InstCombine')
370 files changed, 2053 insertions, 487 deletions
diff --git a/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll b/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll index 94ce68e989b3b..5d027a744920a 100644 --- a/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll +++ b/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll @@ -1,6 +1,6 @@ ; This testcase causes instcombine to hang. ; -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine define void @test(i32 %X) { %reg117 = add i32 %X, 0 ; <i32> [#uses=0] diff --git a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll index 34c2df605e427..d2b2b0027a52c 100644 --- a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll +++ b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll @@ -1,6 +1,6 @@ ; Instcombine was missing a test that caused it to make illegal transformations ; sometimes. In this case, it transforms the sub into an add: -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub +; RUN: opt < %s -instcombine -S | grep sub ; define i32 @test(i32 %i, i32 %j) { %A = mul i32 %i, %j diff --git a/test/Transforms/InstCombine/2002-08-02-CastTest.ll b/test/Transforms/InstCombine/2002-08-02-CastTest.ll index 54c836c1056c7..363cb21e39582 100644 --- a/test/Transforms/InstCombine/2002-08-02-CastTest.ll +++ b/test/Transforms/InstCombine/2002-08-02-CastTest.ll @@ -1,7 +1,7 @@ ; This testcase is incorrectly getting completely eliminated. There should be ; SOME instruction named %c here, even if it's a bitwise and. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep %c +; RUN: opt < %s -instcombine -S | grep %c ; define i64 @test3(i64 %A) { %c1 = trunc i64 %A to i8 ; <i8> [#uses=1] diff --git a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll index e7bd6a8da2fbe..22574f77f1d90 100644 --- a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll +++ b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep add +; RUN: opt < %s -instcombine -S | not grep add define i32 @test(i32 %A) { %A.neg = sub i32 0, %A ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll b/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll index e7e784882ab5b..19010d22d729c 100644 --- a/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll +++ b/test/Transforms/InstCombine/2003-05-26-CastMiscompile.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 4294967295 +; RUN: opt < %s -instcombine -S | grep 4294967295 define i64 @test(i64 %Val) { %tmp.3 = trunc i64 %Val to i32 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll b/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll index 214fa4d846dbc..8645249b7caea 100644 --- a/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll +++ b/test/Transforms/InstCombine/2003-05-27-ConstExprCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output @X = global i32 5 ; <i32*> [#uses=1] diff --git a/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll b/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll index 724f30f488948..154f3ba65e973 100644 --- a/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll +++ b/test/Transforms/InstCombine/2003-06-05-BranchInvertInfLoop.ll @@ -2,7 +2,7 @@ ; because it things that the constant value is a not expression... and ; constantly inverts the branch back and forth. ; -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i8 @test19(i1 %c) { br i1 true, label %True, label %False diff --git a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll index 09732d3f636ae..f550c8349f84a 100644 --- a/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll +++ b/test/Transforms/InstCombine/2003-07-21-ExternalConstant.ll @@ -10,7 +10,7 @@ ; should pass through the optimizer without failure. ; ; Extra code: -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; END. target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll index 209ab1b33695c..6d227547c8d5a 100644 --- a/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll +++ b/test/Transforms/InstCombine/2003-08-12-AllocaNonNull.ll @@ -1,6 +1,6 @@ ; This testcase can be simplified by "realizing" that alloca can never return ; null. -; RUN: llvm-as < %s | opt -instcombine -simplifycfg | \ +; RUN: opt < %s -instcombine -simplifycfg | \ ; RUN: llvm-dis | not grep br declare i32 @bitmap_clear(...) diff --git a/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll index 9779f21f925c2..32979191f853b 100644 --- a/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll +++ b/test/Transforms/InstCombine/2003-09-09-VolatileLoadElim.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load +; RUN: opt < %s -instcombine -S | grep load define void @test(i32* %P) { ; Dead but not deletable! diff --git a/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll index 7d219cb358856..cfe5df6d30a36 100644 --- a/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll +++ b/test/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output declare i32* @bar() diff --git a/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll index 71585d426645c..c1692f77abb21 100644 --- a/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll +++ b/test/Transforms/InstCombine/2003-11-03-VarargsCallBug.ll @@ -1,5 +1,5 @@ ; The cast in this testcase is not eliminable on a 32-bit target! -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep inttoptr +; RUN: opt < %s -instcombine -S | grep inttoptr target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll index b6930b5a65fde..4d3d48ef375f6 100644 --- a/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll +++ b/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll @@ -1,8 +1,11 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep call | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s declare void @free(i8*) define void @test(i32* %X) { call void (...)* bitcast (void (i8*)* @free to void (...)*)( i32* %X ) ; <i32>:1 [#uses=0] +; CHECK: %tmp = bitcast i32* %X to i8* +; CHECK: call void @free(i8* %tmp) ret void +; CHECK: ret void } diff --git a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll index c6a6b6afb81dd..bec0b9e0c5733 100644 --- a/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll +++ b/test/Transforms/InstCombine/2004-01-13-InstCombineInvokePHI.ll @@ -5,7 +5,7 @@ ; invoke instruction, we really cannot perform this transformation at all at ; least without splitting the critical edge. ; -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output declare i8* @test() diff --git a/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll b/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll index 3a4b66157dfe9..a08e3a884ceb3 100644 --- a/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll +++ b/test/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 34 +; RUN: opt < %s -instcombine -S | not grep 34 define i32 @test(i32 %X) { ; Do not fold into shr X, 34, as this uses undefined behavior! diff --git a/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll b/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll index 2b5481b0195ae..ff20d7db9483d 100644 --- a/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll +++ b/test/Transforms/InstCombine/2004-03-13-InstCombineInfLoop.ll @@ -1,7 +1,7 @@ ; This testcase caused the combiner to go into an infinite loop, moving the ; cast back and forth, changing the seteq to operate on int vs uint and back. -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i1 @test(i32 %A, i32 %B) { %C = sub i32 0, %A ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll b/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll index 0b93eb2322eb5..84f9bad69d8d8 100644 --- a/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll +++ b/test/Transforms/InstCombine/2004-04-04-InstCombineReplaceAllUsesWith.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i32 @test() { ret i32 0 diff --git a/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll index 66a5a4d78f6aa..8b549374a70ca 100644 --- a/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll +++ b/test/Transforms/InstCombine/2004-05-07-UnsizedCastLoad.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output %Ty = type opaque diff --git a/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll b/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll index 82eecbb6986bf..819260b60b127 100644 --- a/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll +++ b/test/Transforms/InstCombine/2004-07-27-ConstantExprMul.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output @p = weak global i32 0 ; <i32*> [#uses=1] diff --git a/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll b/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll index 9fc48de4ec193..f3e5d77c0c806 100644 --- a/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll +++ b/test/Transforms/InstCombine/2004-08-09-RemInfLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; This testcase should not send the instcombiner into an infinite loop! diff --git a/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll b/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll index 5d2ed0b86d9db..1154bb481d30a 100644 --- a/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll +++ b/test/Transforms/InstCombine/2004-08-10-BoolSetCC.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {ret i1 false} define i1 @test(i1 %V) { diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll index e56c390d13f4a..8169d2127f7fa 100644 --- a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll +++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \ +; RUN: opt < %s -instcombine -mem2reg -S | \ ; RUN: not grep {i32 1} ; When propagating the load through the select, make sure that the load is diff --git a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll index b89bd228403ea..e646edf0296c7 100644 --- a/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll +++ b/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | \ +; RUN: opt < %s -instcombine -mem2reg -simplifycfg | \ ; RUN: llvm-dis | grep -v store | not grep {i32 1} ; Test to make sure that instcombine does not accidentally propagate the load diff --git a/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll b/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll index ee4f62c8d5ce2..27c823b9e6332 100644 --- a/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll +++ b/test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep -- -65536 +; RUN: opt < %s -instcombine -S | not grep -- -65536 define i1 @test(i32 %tmp.124) { %tmp.125 = shl i32 %tmp.124, 8 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll b/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll index 766ba48be63f4..730fdc26aabd5 100644 --- a/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll +++ b/test/Transforms/InstCombine/2004-11-22-Missed-and-fold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and +; RUN: opt < %s -instcombine -S | not grep and define i8 @test21(i8 %A) { ;; sign extend diff --git a/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll index 53bb4965cb493..187e2f594d69b 100644 --- a/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll +++ b/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll @@ -9,124 +9,152 @@ ; be eliminated. In many cases the setCC is also eliminated based on the ; constant value and the range of the casted value. ; -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \ -; RUN: notcast .*int +; RUN: opt < %s -instcombine -S | FileCheck %s ; END. define i1 @lt_signed_to_large_unsigned(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ult i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C1 = icmp sgt i8 %SB, -1 +; CHECK: ret i1 %C1 } define i1 @lt_signed_to_large_signed(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } define i1 @lt_signed_to_large_negative(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, -1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @lt_signed_to_small_signed(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, 17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp slt i8 %SB, 17 +; CHECK: ret i1 %C } define i1 @lt_signed_to_small_negative(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, -17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp slt i8 %SB, -17 +; CHECK: ret i1 %C } define i1 @lt_unsigned_to_large_unsigned(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ult i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } define i1 @lt_unsigned_to_large_signed(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } define i1 @lt_unsigned_to_large_negative(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, -1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @lt_unsigned_to_small_unsigned(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ult i32 %Y, 17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp ult i8 %SB, 17 +; CHECK: ret i1 %C } define i1 @lt_unsigned_to_small_negative(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp slt i32 %Y, -17 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @gt_signed_to_large_unsigned(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ugt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp slt i8 %SB, 0 +; CHECK: ret i1 %C } define i1 @gt_signed_to_large_signed(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @gt_signed_to_large_negative(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, -1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } + define i1 @gt_signed_to_small_signed(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, 17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp sgt i8 %SB, 17 +; CHECK: ret i1 %C } define i1 @gt_signed_to_small_negative(i8 %SB) { %Y = sext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, -17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp sgt i8 %SB, -17 +; CHECK: ret i1 %C } define i1 @gt_unsigned_to_large_unsigned(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ugt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @gt_unsigned_to_large_signed(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, 1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 false } define i1 @gt_unsigned_to_large_negative(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, -1024 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } define i1 @gt_unsigned_to_small_unsigned(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp ugt i32 %Y, 17 ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp ugt i8 %SB, 17 +; CHECK: ret i1 %C } define i1 @gt_unsigned_to_small_negative(i8 %SB) { %Y = zext i8 %SB to i32 ; <i32> [#uses=1] %C = icmp sgt i32 %Y, -17 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } diff --git a/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll b/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll index 4ea0b5c484bd1..008afa8a787d7 100644 --- a/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll +++ b/test/Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine define i32 @test(i32 %X) { %Y = srem i32 %X, undef ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll b/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll index ffaa0051e9f03..38553d7988107 100644 --- a/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll +++ b/test/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {ret i1 false} define i1 @test(i64 %tmp.169) { diff --git a/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll b/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll index 8b2aa35bd754f..1ec118006deb8 100644 --- a/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll +++ b/test/Transforms/InstCombine/2005-04-07-UDivSelectCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i32 @test(i1 %C, i32 %tmp.15) { %tmp.16 = select i1 %C, i32 8, i32 1 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll b/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll index 53585f9aa38b6..9846ee72dd4b8 100644 --- a/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll +++ b/test/Transforms/InstCombine/2005-06-15-DivSelectCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i32 @_Z13func_31585107li(i32 %l_39521025, i32 %l_59244666) { %shortcirc_val = select i1 false, i32 1, i32 0 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll b/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll index 64bfec18df6b3..e2d0618a41e6b 100644 --- a/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll +++ b/test/Transforms/InstCombine/2005-06-15-ShiftSetCCCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR577 define i1 @test() { diff --git a/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll b/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll index 10dbfec21ae31..f0e60aca59f5d 100644 --- a/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll +++ b/test/Transforms/InstCombine/2005-06-16-RangeCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR585 define i1 @test() { diff --git a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll index 010087b4f4725..3d887ddad02b5 100644 --- a/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll +++ b/test/Transforms/InstCombine/2005-06-16-SetCCOrSetCCMiscompile.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {ret i1 true} ; PR586 diff --git a/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll b/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll index c58234a549955..caee951b704c2 100644 --- a/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll +++ b/test/Transforms/InstCombine/2005-07-07-DeadPHILoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; This example caused instcombine to spin into an infinite loop. diff --git a/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll b/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll index c89b0d54a9ddc..10541ef703255 100644 --- a/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll +++ b/test/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep undef define i32 @test(i8 %A) { diff --git a/test/Transforms/InstCombine/2006-02-28-Crash.ll b/test/Transforms/InstCombine/2006-02-28-Crash.ll index 1f3c9e8e67409..9bea14c027ea6 100644 --- a/test/Transforms/InstCombine/2006-02-28-Crash.ll +++ b/test/Transforms/InstCombine/2006-02-28-Crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i32 @test() { %tmp203 = icmp eq i32 1, 2 ; <i1> [#uses=1] diff --git a/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll b/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll index e4b2b39312241..aa7d58786b424 100644 --- a/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll +++ b/test/Transforms/InstCombine/2006-03-30-ExtractElement.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define float @test(<4 x float> %V) { %V2 = insertelement <4 x float> %V, float 1.000000e+00, i32 3 ; <<4 x float>> [#uses=1] diff --git a/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll b/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll index 2541eb7330319..c337ea781e4b1 100644 --- a/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll +++ b/test/Transforms/InstCombine/2006-04-28-ShiftShiftLongLong.ll @@ -1,11 +1,13 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s ; This cannot be turned into a sign extending cast! define i64 @test(i64 %X) { %Y = shl i64 %X, 16 ; <i64> [#uses=1] +; CHECK: %Y = shl i64 %X, 16 %Z = ashr i64 %Y, 16 ; <i64> [#uses=1] +; CHECK: %Z = ashr i64 %Y, 16 ret i64 %Z +; CHECK: ret i64 %Z } diff --git a/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll b/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll index 1b9df405c5ad8..e22395fb87743 100644 --- a/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll +++ b/test/Transforms/InstCombine/2006-05-04-DemandedBitCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; END. define void @test() { diff --git a/test/Transforms/InstCombine/2006-09-15-CastToBool.ll b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll index 043b598c8966f..ee261ced5869a 100644 --- a/test/Transforms/InstCombine/2006-09-15-CastToBool.ll +++ b/test/Transforms/InstCombine/2006-09-15-CastToBool.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and +; RUN: opt < %s -instcombine -S | grep and ; PR913 define i32 @test(i32* %tmp1) { diff --git a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll index 4ca3dc1ec1c1c..889bbcfa3ea5b 100644 --- a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll +++ b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll @@ -1,5 +1,5 @@ ; The optimizer should be able to remove cast operation here. -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep sext.*i32 define i1 @eq_signed_to_small_unsigned(i8 %SB) { diff --git a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll index 8678a85c4648c..4d1a9ef21655b 100644 --- a/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll +++ b/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst.ll @@ -1,6 +1,6 @@ ; This test case is reduced from llvmAsmParser.cpp ; The optimizer should not remove the cast here. -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep sext.*i32 diff --git a/test/Transforms/InstCombine/2006-10-20-mask.ll b/test/Transforms/InstCombine/2006-10-20-mask.ll index a5864f1c1831f..0aaa5e8c21b4b 100644 --- a/test/Transforms/InstCombine/2006-10-20-mask.ll +++ b/test/Transforms/InstCombine/2006-10-20-mask.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep and define i64 @foo(i64 %tmp, i64 %tmp2) { diff --git a/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll index c7cf0dd017c79..d3ba1e2287a3d 100644 --- a/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll +++ b/test/Transforms/InstCombine/2006-10-26-VectorReassoc.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep mul | count 2 define <4 x float> @test(<4 x float> %V) { diff --git a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll index 23e805a9360c6..35bb45e2b9130 100644 --- a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll +++ b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep memmove.i32 ; Instcombine was trying to turn this into a memmove.i32 diff --git a/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll b/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll index 8c48d4357bcaa..7799423f04f67 100644 --- a/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll +++ b/test/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep lshr +; RUN: opt < %s -instcombine -S | grep lshr ; Verify this is not turned into -1. define i32 @test(i8 %amt) { diff --git a/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll b/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll index eaf10a306f587..7adeb9fd96031 100644 --- a/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll +++ b/test/Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep add +; RUN: opt < %s -instcombine -S | grep sub +; RUN: opt < %s -instcombine -S | grep add define <4 x float> @test(<4 x float> %tmp26, <4 x float> %tmp53) { ; (X+Y)-Y != X for fp vectors. diff --git a/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll b/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll index 2c3313efa2a8f..74483c1d9c773 100644 --- a/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll +++ b/test/Transforms/InstCombine/2006-12-05-fp-to-int-ext.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zext +; RUN: opt < %s -instcombine -S | grep zext ; Never merge these two conversions, even though it's possible: this is ; significantly more expensive than the two conversions on some targets diff --git a/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll b/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll index ddfb88c7bfbb0..80ee3e2a293f7 100644 --- a/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll +++ b/test/Transforms/InstCombine/2006-12-08-ICmp-Combining.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {%bothcond =} define i1 @Doit_bb(i32 %i.0) { diff --git a/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll index 1508a523b7a9c..5a74bd2ab7d61 100644 --- a/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll +++ b/test/Transforms/InstCombine/2006-12-08-Phi-ICmp-Op-Fold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {icmp sgt} ; END. target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll index e4aade7b8ea41..2665791fe086a 100644 --- a/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll +++ b/test/Transforms/InstCombine/2006-12-08-Select-ICmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select +; RUN: opt < %s -instcombine -S | grep select ; END. target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2006-12-15-Range-Test.ll b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll index 67bc84c4045cb..c3700a00c428c 100644 --- a/test/Transforms/InstCombine/2006-12-15-Range-Test.ll +++ b/test/Transforms/InstCombine/2006-12-15-Range-Test.ll @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep icmp | count 1 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {icmp ugt} | count 1 ; END. diff --git a/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll index 695aea46ee2cf..eba1ac1298ce4 100644 --- a/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll +++ b/test/Transforms/InstCombine/2006-12-23-Select-Cmp-Cmp.ll @@ -1,6 +1,6 @@ ; For PR1065. This causes an assertion in instcombine if a select with two cmp ; operands is encountered. -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; END. target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll b/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll index edbcfeed923a9..e5238a577d2d8 100644 --- a/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll +++ b/test/Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp ugt} +; RUN: opt < %s -instcombine -S | grep {icmp ugt} ; PR1107 ; PR1940 diff --git a/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll b/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll index 073d3a1541286..d2d215fa86d38 100644 --- a/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll +++ b/test/Transforms/InstCombine/2007-01-14-FcmpSelf.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {fcmp uno.*0.0} +; RUN: opt < %s -instcombine -S | grep {fcmp uno.*0.0} ; PR1111 define i1 @test(double %X) { %tmp = fcmp une double %X, %X diff --git a/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll b/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll index 83d05d9d94f76..fed2255c0e29d 100644 --- a/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll +++ b/test/Transforms/InstCombine/2007-01-18-VectorInfLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define <4 x i32> @test(<4 x i32> %A) { %B = xor <4 x i32> %A, < i32 -1, i32 -1, i32 -1, i32 -1 > diff --git a/test/Transforms/InstCombine/2007-01-27-AndICmp.ll b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll index 0e8c5b17666e3..bd15dce11acbd 100644 --- a/test/Transforms/InstCombine/2007-01-27-AndICmp.ll +++ b/test/Transforms/InstCombine/2007-01-27-AndICmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ugt.*, 1} +; RUN: opt < %s -instcombine -S | grep {ugt.*, 1} define i1 @test(i32 %tmp1030) { %tmp1037 = icmp ne i32 %tmp1030, 40 ; <i1> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll index e559cdd914a91..05891a203ab0e 100644 --- a/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll +++ b/test/Transforms/InstCombine/2007-02-01-LoadSinkAlloca.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | grep {%A = alloca} -; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \ +; RUN: opt < %s -instcombine -mem2reg -S | grep {%A = alloca} +; RUN: opt < %s -instcombine -mem2reg -S | \ ; RUN: not grep {%B = alloca} ; END. diff --git a/test/Transforms/InstCombine/2007-02-07-PointerCast.ll b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll index ce9eb3c69d4bc..bf60991f7dd94 100644 --- a/test/Transforms/InstCombine/2007-02-07-PointerCast.ll +++ b/test/Transforms/InstCombine/2007-02-07-PointerCast.ll @@ -1,4 +1,4 @@ -;RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zext +;RUN: opt < %s -instcombine -S | grep zext ; Make sure the uint isn't removed. Instcombine in llvm 1.9 was dropping the ; uint cast which was causing a sign extend. This only affected code with diff --git a/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll b/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll index d60da44b7f19a..f31c280661d04 100644 --- a/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll +++ b/test/Transforms/InstCombine/2007-02-23-PhiFoldInfLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret +; RUN: opt < %s -instcombine -S | grep ret ; PR1217 target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll b/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll index d101050e93074..109e4a217fb53 100644 --- a/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll +++ b/test/Transforms/InstCombine/2007-03-13-CompareMerge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp sle} +; RUN: opt < %s -instcombine -S | grep {icmp sle} ; PR1244 define i1 @test(i32 %c.3.i, i32 %d.292.2.i) { diff --git a/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll b/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll index da58dec1dcaab..589bd805d6ddb 100644 --- a/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll +++ b/test/Transforms/InstCombine/2007-03-19-BadTruncChangePR1261.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep zext +; RUN: opt < %s -instcombine -S | grep zext ; PR1261. define i16 @test(i31 %zzz) { diff --git a/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll b/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll index c8dafd166299b..ca93af3a69105 100644 --- a/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll +++ b/test/Transforms/InstCombine/2007-03-21-SignedRangeTest.ll @@ -1,5 +1,5 @@ ; For PR1248 -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | grep {ugt i32 .*, 11} +; RUN: opt < %s -instcombine -S | grep {ugt i32 .*, 11} define i1 @test(i32 %tmp6) { %tmp7 = sdiv i32 %tmp6, 12 ; <i32> [#uses=1] icmp ne i32 %tmp7, -6 ; <i1>:1 [#uses=1] diff --git a/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll index 0b05f7c643201..c79400413ff34 100644 --- a/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll +++ b/test/Transforms/InstCombine/2007-03-25-BadShiftMask.ll @@ -1,5 +1,5 @@ ; PR1271 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {icmp eq i32 .tmp.*, 2146435072} %struct..0anon = type { i32, i32 } %struct..1anon = type { double } diff --git a/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll b/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll index d67e1a13cc4e8..0d4aac25c28f6 100644 --- a/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll +++ b/test/Transforms/InstCombine/2007-03-25-DoubleShift.ll @@ -1,5 +1,5 @@ ; PR1271 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and +; RUN: opt < %s -instcombine -S | grep and define i1 @test(i32 %tmp13) { entry: %tmp14 = shl i32 %tmp13, 12 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll b/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll index 4a2e60e7c35c4..5bcb54306065a 100644 --- a/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll +++ b/test/Transforms/InstCombine/2007-03-26-BadShiftMask.ll @@ -1,5 +1,5 @@ ; PR1271 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {ashr i32 %.mp137, 2} ; END. diff --git a/test/Transforms/InstCombine/2007-03-27-PR1280.ll b/test/Transforms/InstCombine/2007-03-27-PR1280.ll index 6cb9aaec09873..7700c7dd8a698 100644 --- a/test/Transforms/InstCombine/2007-03-27-PR1280.ll +++ b/test/Transforms/InstCombine/2007-03-27-PR1280.ll @@ -4,7 +4,7 @@ ; is not done. It should be removed when code gen supports "funny" ; bit widths. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i49.*-8388608} +; RUN: opt < %s -instcombine -S | grep {add i49.*-8388608} define i49 @test5(i49 %x) { ;; If we have ADD(XOR(AND(X, 0xFF), 0x80), 0xF..F80), it's a sext. diff --git a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll index e738635be7631..b59d3c80335e4 100644 --- a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll +++ b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll @@ -2,7 +2,7 @@ ; a malloc messes up the element count, causing an extra 4GB to be allocated on ; 64-bit targets. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {= add } +; RUN: opt < %s -instcombine -S | not grep {= add } target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "x86_64-unknown-freebsd6.2" diff --git a/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll b/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll index 34322a2788a2e..22eb2c23c34b7 100644 --- a/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll +++ b/test/Transforms/InstCombine/2007-04-08-SingleEltVectorCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR1304 define i64 @bork(<1 x i64> %vec) { diff --git a/test/Transforms/InstCombine/2007-05-04-Crash.ll b/test/Transforms/InstCombine/2007-05-04-Crash.ll index 5ad7919335742..9f50d8ac9b064 100644 --- a/test/Transforms/InstCombine/2007-05-04-Crash.ll +++ b/test/Transforms/InstCombine/2007-05-04-Crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR1384 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" diff --git a/test/Transforms/InstCombine/2007-05-10-icmp-or.ll b/test/Transforms/InstCombine/2007-05-10-icmp-or.ll index 8769ded67b8e5..4af5dfeef5ddb 100644 --- a/test/Transforms/InstCombine/2007-05-10-icmp-or.ll +++ b/test/Transforms/InstCombine/2007-05-10-icmp-or.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define i1 @test(i32 %tmp9) { %tmp20 = icmp ugt i32 %tmp9, 255 ; <i1> [#uses=1] %tmp11.not = icmp sgt i32 %tmp9, 255 ; <i1> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-05-14-Crash.ll b/test/Transforms/InstCombine/2007-05-14-Crash.ll index ececd350dba97..a3c010d2c4273 100644 --- a/test/Transforms/InstCombine/2007-05-14-Crash.ll +++ b/test/Transforms/InstCombine/2007-05-14-Crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "powerpc-apple-darwin8.8.0" diff --git a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll index 55bfac581faf7..40818d40c29a4 100644 --- a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll +++ b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*sret} +; RUN: opt < %s -instcombine -S | grep {call.*sret} ; Make sure instcombine doesn't drop the sret attribute. define void @blah(i16* %tmp10) { diff --git a/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll index 482c60869600a..62b93513b76c5 100644 --- a/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll +++ b/test/Transforms/InstCombine/2007-06-06-AshrSignBit.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ashr} +; RUN: opt < %s -instcombine -S | grep {ashr} ; PR1499 define void @av_cmp_q_cond_true(i32* %retval, i32* %tmp9, i64* %tmp10) { diff --git a/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll b/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll index ffc402650262f..af539c12a339b 100644 --- a/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll +++ b/test/Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true} +; RUN: opt < %s -instcombine -S | grep {ret i1 true} ; rdar://5278853 define i1 @test(i32 %tmp468) { diff --git a/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll b/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll index 988599ba3f95a..3f76187b780a4 100644 --- a/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll +++ b/test/Transforms/InstCombine/2007-08-02-InfiniteLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR1594 define i64 @test(i16 %tmp510, i16 %tmp512) { diff --git a/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll index 2dcb43926ba8e..c27fe0ab6a6db 100644 --- a/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll +++ b/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp +; RUN: opt < %s -instcombine -S | grep icmp ; PR1646 @__gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll index c022e571e11fb..d8f3d97017ba2 100644 --- a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll +++ b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call i32 @f} +; RUN: opt < %s -instcombine -S | grep {call i32 @f} %struct.FRAME.nest = type { i32, i32 (i32)* } %struct.__builtin_trampoline = type { [10 x i8] } diff --git a/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll b/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll index 300edd5e56eef..23ee12ba754f4 100644 --- a/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll +++ b/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp +; RUN: opt < %s -instcombine -S | grep icmp ; PR1678 @A = alias weak void ()* @B ; <void ()*> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll index 6d251b12cf4f8..3862de455d559 100644 --- a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll +++ b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call -; RUN: llvm-as < %s | opt -std-compile-opts | llvm-dis | not grep xyz +; RUN: opt < %s -instcombine -S | not grep call +; RUN: opt < %s -std-compile-opts -S | not grep xyz @.str = internal constant [4 x i8] c"xyz\00" ; <[4 x i8]*> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-10-12-Crash.ll b/test/Transforms/InstCombine/2007-10-12-Crash.ll index ed98fcdb9cae6..b3d9f02b68aa9 100644 --- a/test/Transforms/InstCombine/2007-10-12-Crash.ll +++ b/test/Transforms/InstCombine/2007-10-12-Crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output %struct.Ray = type { %struct.Vec, %struct.Vec } %struct.Scene = type { i32 (...)** } diff --git a/test/Transforms/InstCombine/2007-10-28-stacksave.ll b/test/Transforms/InstCombine/2007-10-28-stacksave.ll index 5f884d4a78124..76bceb6879bb2 100644 --- a/test/Transforms/InstCombine/2007-10-28-stacksave.ll +++ b/test/Transforms/InstCombine/2007-10-28-stacksave.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stacksave} +; RUN: opt < %s -instcombine -S | grep {call.*stacksave} ; PR1745 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" diff --git a/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll index 15e54b1bf7493..8105b4ba5579a 100644 --- a/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll +++ b/test/Transforms/InstCombine/2007-10-31-RangeCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f128:64:128" target triple = "powerpc-apple-darwin8" diff --git a/test/Transforms/InstCombine/2007-10-31-StringCrash.ll b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll index 6ba07e8a5a15b..220f3e22b9912 100644 --- a/test/Transforms/InstCombine/2007-10-31-StringCrash.ll +++ b/test/Transforms/InstCombine/2007-10-31-StringCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" diff --git a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll index f3caf07976388..e1549a0fe5410 100644 --- a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll +++ b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR1780 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll b/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll index d7ac211372876..5282739d5c7fa 100644 --- a/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll +++ b/test/Transforms/InstCombine/2007-11-15-CompareMiscomp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %In, 1} +; RUN: opt < %s -instcombine -S | grep {icmp eq i32 %In, 1} ; PR1800 define i1 @test(i32 %In) { diff --git a/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll b/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll index 1f211b65d3fdb..f71b99ce1a4b8 100644 --- a/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll +++ b/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR1817 define i1 @test1(i32 %X) { diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll index 60a4b3b4ab52c..24394c63e4d7f 100644 --- a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll +++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast +; RUN: opt < %s -instcombine -S | not grep bitcast ; PR1716 @.str = internal constant [4 x i8] c"%d\0A\00" ; <[4 x i8]*> [#uses=1] diff --git a/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll b/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll index 80df6fbdce352..6420537b9de7f 100644 --- a/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll +++ b/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll @@ -1,6 +1,6 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i686-pc-linux-gnu" -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {ret i1 0} +; RUN: opt < %s -instcombine -S | not grep {ret i1 0} ; PR1850 define i1 @test() { diff --git a/test/Transforms/InstCombine/2007-12-12-GEPScale.ll b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll index 6580f90411a6b..cea87f2a4666c 100644 --- a/test/Transforms/InstCombine/2007-12-12-GEPScale.ll +++ b/test/Transforms/InstCombine/2007-12-12-GEPScale.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 1431655764 +; RUN: opt < %s -instcombine -S | not grep 1431655764 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll b/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll index 336c6d5a2eba6..85cf9b6904cb0 100644 --- a/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll +++ b/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep nounwind +; RUN: opt < %s -instcombine -S | grep nounwind define void @bar() { entry: diff --git a/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll b/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll index e44fc6f099a76..cc89f6dd2056e 100644 --- a/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll +++ b/test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add} | count 1 +; RUN: opt < %s -instcombine -S | grep {add} | count 1 define i32 @foo(i32 %a) { entry: diff --git a/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll index 5e95993960c71..b59548fd8e6f1 100644 --- a/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll +++ b/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -mem2reg -instcombine | llvm-dis | grep "ret i32 1" | count 8 +; RUN: opt < %s -mem2reg -instcombine -S | grep "ret i32 1" | count 8 define i32 @test1() { entry: diff --git a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll index 277b4f09075e4..5f4fa478dab28 100644 --- a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll @@ -1,5 +1,5 @@ ; Ignore stderr, we expect warnings there -; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | not grep bitcast +; RUN: opt < %s -instcombine 2> /dev/null -S | not grep bitcast define void @a() { ret void diff --git a/test/Transforms/InstCombine/2008-01-06-CastCrash.ll b/test/Transforms/InstCombine/2008-01-06-CastCrash.ll index 1d816d4b9967e..097a0ce849d05 100644 --- a/test/Transforms/InstCombine/2008-01-06-CastCrash.ll +++ b/test/Transforms/InstCombine/2008-01-06-CastCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define <2 x i32> @f() { ret <2 x i32> undef diff --git a/test/Transforms/InstCombine/2008-01-06-VoidCast.ll b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll index 015210a998311..407ff4ddc29af 100644 --- a/test/Transforms/InstCombine/2008-01-06-VoidCast.ll +++ b/test/Transforms/InstCombine/2008-01-06-VoidCast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast +; RUN: opt < %s -instcombine -S | not grep bitcast define void @f(i16 %y) { ret void diff --git a/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll b/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll index 71d5bf762c34b..fbc8ba972a032 100644 --- a/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll +++ b/test/Transforms/InstCombine/2008-01-13-AndCmpCmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and +; RUN: opt < %s -instcombine -S | grep and ; PR1907 define i1 @test(i32 %c84.17) { diff --git a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll index d791d7be26ec2..7b3281ff4eadb 100644 --- a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast | count 2 +; RUN: opt < %s -instcombine -S | grep bitcast | count 2 define i32 @b(i32* inreg %x) signext { ret i32 0 diff --git a/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll b/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll index 5381db2acbcb4..6401dfd0c11ea 100644 --- a/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll +++ b/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output %struct.FRAME.nest = type { i32, i32 (i32*)* } %struct.__builtin_trampoline = type { [10 x i8] } diff --git a/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll index e35794a813b09..9bb940893935f 100644 --- a/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll +++ b/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zeroext +; RUN: opt < %s -instcombine -S | grep zeroext %struct.FRAME.nest = type { i32, i32 (...)* } %struct.__builtin_trampoline = type { [10 x i8] } diff --git a/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll b/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll index 0c2cf54369cd5..5ff23a3881fa0 100644 --- a/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll +++ b/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {icmp s} +; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1940 define i1 @test1(i8 %A, i8 %B) { @@ -7,6 +6,8 @@ define i1 @test1(i8 %A, i8 %B) { %b = zext i8 %B to i32 %c = icmp sgt i32 %a, %b ret i1 %c +; CHECK: %c = icmp ugt i8 %A, %B +; CHECK: ret i1 %c } define i1 @test2(i8 %A, i8 %B) { @@ -14,4 +15,6 @@ define i1 @test2(i8 %A, i8 %B) { %b = sext i8 %B to i32 %c = icmp ugt i32 %a, %b ret i1 %c +; CHECK: %c = icmp ugt i8 %A, %B +; CHECK: ret i1 %c } diff --git a/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll b/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll index 8de0959bf7542..a49829af2ee8d 100644 --- a/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll +++ b/test/Transforms/InstCombine/2008-01-21-MulTrunc.ll @@ -1,11 +1,15 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i16 @test1(i16 %a) { %tmp = zext i16 %a to i32 ; <i32> [#uses=2] %tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1] +; CHECK: %tmp21 = lshr i16 %a, 8 %tmp5 = mul i32 %tmp, 5 ; <i32> [#uses=1] +; CHECK: %tmp5 = mul i16 %a, 5 %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1] +; CHECK: %tmp.upgrd.32 = or i16 %tmp21, %tmp5 %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1] ret i16 %tmp.upgrd.3 +; CHECK: ret i16 %tmp.upgrd.32 } diff --git a/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll index 346f90f8293b8..c161bcc9045dc 100644 --- a/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll +++ b/test/Transforms/InstCombine/2008-01-27-FloatSelect.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select +; RUN: opt < %s -instcombine -S | grep select define double @fold(i1 %a, double %b) { %s = select i1 %a, double 0., double 1. diff --git a/test/Transforms/InstCombine/2008-01-29-AddICmp.ll b/test/Transforms/InstCombine/2008-01-29-AddICmp.ll index d937f7bb2303d..28a94ce07ad20 100644 --- a/test/Transforms/InstCombine/2008-01-29-AddICmp.ll +++ b/test/Transforms/InstCombine/2008-01-29-AddICmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {a.off} +; RUN: opt < %s -instcombine -S | not grep {a.off} ; PR1949 define i1 @test1(i32 %a) { diff --git a/test/Transforms/InstCombine/2008-02-13-MulURem.ll b/test/Transforms/InstCombine/2008-02-13-MulURem.ll index 669738378970c..a88c510972475 100644 --- a/test/Transforms/InstCombine/2008-02-13-MulURem.ll +++ b/test/Transforms/InstCombine/2008-02-13-MulURem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep rem +; RUN: opt < %s -instcombine -S | grep rem ; PR1933 define i32 @fold(i32 %a) { diff --git a/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll b/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll index cd61a10c5b856..af61c150a7f8f 100644 --- a/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll +++ b/test/Transforms/InstCombine/2008-02-16-SDivOverflow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i.* 0} | count 2 +; RUN: opt < %s -instcombine -S | grep {ret i.* 0} | count 2 ; PR2048 define i32 @i(i32 %a) { diff --git a/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll b/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll index 0e260c465e32c..d26dec11e25d8 100644 --- a/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll +++ b/test/Transforms/InstCombine/2008-02-16-SDivOverflow2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {sdiv i8 \%a, 9} +; RUN: opt < %s -instcombine -S | grep {sdiv i8 \%a, 9} ; PR2048 define i8 @i(i8 %a) { diff --git a/test/Transforms/InstCombine/2008-02-23-MulSub.ll b/test/Transforms/InstCombine/2008-02-23-MulSub.ll index a74e98d448603..bb21c4b034176 100644 --- a/test/Transforms/InstCombine/2008-02-23-MulSub.ll +++ b/test/Transforms/InstCombine/2008-02-23-MulSub.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep mul define i26 @test(i26 %a) nounwind { entry: diff --git a/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll b/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll index ea02403956268..7f8bd4fb8a90f 100644 --- a/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll +++ b/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; rdar://5771353 define float @test(float %x, x86_fp80 %y) nounwind readonly { diff --git a/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll index 31e7e35bef1f3..da7e49ee84752 100644 --- a/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll +++ b/test/Transforms/InstCombine/2008-03-13-IntToPtr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {16} | count 1 +; RUN: opt < %s -instcombine -S | grep {16} | count 1 define i8* @bork(i8** %qux) { %tmp275 = load i8** %qux, align 1 diff --git a/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll index 020121375feaf..aa38065a71499 100644 --- a/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll +++ b/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll @@ -1,6 +1,6 @@ ;; The bitcast cannot be eliminated because byval arguments need ;; the correct type, or at least a type of the correct size. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast +; RUN: opt < %s -instcombine -S | grep bitcast target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9" %struct.NSRect = type { [4 x float] } diff --git a/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll b/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll index 9bfe7aa141482..626564da936a4 100644 --- a/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll +++ b/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store} +; RUN: opt < %s -instcombine -S | grep {volatile store} define void @test() { %votf = alloca <4 x float> ; <<4 x float>*> [#uses=1] diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll index e43c22daa42a3..f2cc7254a3255 100644 --- a/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll +++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2 +; RUN: opt < %s -instcombine -S | grep {volatile load} | count 2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" @g_1 = internal global i32 0 ; <i32*> [#uses=3] diff --git a/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll index 293052a44711a..176162d386363 100644 --- a/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll +++ b/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2 +; RUN: opt < %s -instcombine -S | grep {volatile load} | count 2 ; PR2262 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" diff --git a/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll index e9cc97df0c616..bbd004213d0ad 100644 --- a/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll +++ b/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 3 +; RUN: opt < %s -instcombine -S | grep {store i8} | count 3 ; PR2297 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" diff --git a/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll index e81e828d51f33..1da28562aae40 100644 --- a/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll +++ b/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | %prcontext strlen 1 | not grep ret +; RUN: opt -S -instcombine %s | FileCheck %s ; PR2297 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" @@ -11,6 +11,10 @@ entry: store i8 0, i8* %tmp3, align 1 %tmp5 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1] store i8 1, i8* %tmp5, align 1 +; CHECK: store +; CHECK: store +; CHECK-NEXT: strlen +; CHECK-NEXT: store %tmp7 = call i32 @strlen( i8* %tmp1 ) nounwind readonly ; <i32> [#uses=1] %tmp9 = getelementptr i8* %tmp1, i32 0 ; <i8*> [#uses=1] store i8 0, i8* %tmp9, align 1 diff --git a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll index 4dd29a79cd7d4..d56a1a0b786ae 100644 --- a/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll +++ b/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR2303 %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 } %"struct.std::locale::facet" = type { i32 (...)**, i32 } diff --git a/test/Transforms/InstCombine/2008-05-17-InfLoop.ll b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll index 9cfbd6f2c5e20..2939a48216547 100644 --- a/test/Transforms/InstCombine/2008-05-17-InfLoop.ll +++ b/test/Transforms/InstCombine/2008-05-17-InfLoop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR2339 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-s0:0:64-f80:32:32" target triple = "i686-pc-linux-gnu" diff --git a/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll b/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll index e994399e423e5..b34fc1e991d4e 100644 --- a/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll +++ b/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} | count 2 +; RUN: opt < %s -instcombine -S | grep {ret i1 false} | count 2 ; PR2329 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/Transforms/InstCombine/2008-05-22-IDivVector.ll b/test/Transforms/InstCombine/2008-05-22-IDivVector.ll index ad70b658d3c10..f7ba99c6b4499 100644 --- a/test/Transforms/InstCombine/2008-05-22-IDivVector.ll +++ b/test/Transforms/InstCombine/2008-05-22-IDivVector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output define <3 x i8> @f(<3 x i8> %i) { %A = sdiv <3 x i8> %i, %i diff --git a/test/Transforms/InstCombine/2008-05-22-NegValVector.ll b/test/Transforms/InstCombine/2008-05-22-NegValVector.ll index f2511b3832549..bf92faf2fec58 100644 --- a/test/Transforms/InstCombine/2008-05-22-NegValVector.ll +++ b/test/Transforms/InstCombine/2008-05-22-NegValVector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sub +; RUN: opt < %s -instcombine -S | not grep sub define <3 x i8> @f(<3 x i8> %a) { %A = sub <3 x i8> zeroinitializer, %a diff --git a/test/Transforms/InstCombine/2008-05-23-CompareFold.ll b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll index c0f34e68a9d8d..2de5af7357372 100644 --- a/test/Transforms/InstCombine/2008-05-23-CompareFold.ll +++ b/test/Transforms/InstCombine/2008-05-23-CompareFold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} +; RUN: opt < %s -instcombine -S | grep {ret i1 false} ; PR2359 define i1 @f(i8* %x) { entry: diff --git a/test/Transforms/InstCombine/2008-05-31-AddBool.ll b/test/Transforms/InstCombine/2008-05-31-AddBool.ll index 7008587c40d98..541669365bdb3 100644 --- a/test/Transforms/InstCombine/2008-05-31-AddBool.ll +++ b/test/Transforms/InstCombine/2008-05-31-AddBool.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor} +; RUN: opt < %s -instcombine -S | grep {xor} ; PR2389 define i1 @test(i1 %a, i1 %b) { diff --git a/test/Transforms/InstCombine/2008-05-31-Bools.ll b/test/Transforms/InstCombine/2008-05-31-Bools.ll index f3df49b352c38..a0fe47a6257b7 100644 --- a/test/Transforms/InstCombine/2008-05-31-Bools.ll +++ b/test/Transforms/InstCombine/2008-05-31-Bools.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: grep {xor} %t ; RUN: grep {and} %t ; RUN: not grep {div} %t diff --git a/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll b/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll index ec13bbf65c182..5e4a9d0e5b305 100644 --- a/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll +++ b/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine define i65 @foo(i65 %x) nounwind { entry: diff --git a/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll index da63dd67453f4..917d3ae1f8438 100644 --- a/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll +++ b/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {phi i32} | count 2 +; RUN: opt < %s -instcombine -S | grep {phi i32} | count 2 define void @test() nounwind { entry: diff --git a/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll b/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll index c671eb8b073e4..08959c9c7c088 100644 --- a/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll +++ b/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i32} | count 2 +; RUN: opt < %s -instcombine -S | grep {store i32} | count 2 @g_139 = global i32 0 ; <i32*> [#uses=2] diff --git a/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll b/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll index 3f23098225e17..aed1b14ce3165 100644 --- a/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll +++ b/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i8} | count 2 +; RUN: opt < %s -instcombine -S | grep {store i8} | count 2 define i32 @a(i8* %s) nounwind { entry: diff --git a/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll index fa3dc0ae141eb..05f1c52000814 100644 --- a/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll +++ b/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load | count 3 +; RUN: opt < %s -instcombine -S | grep load | count 3 ; PR2471 declare i32 @x(i32*) diff --git a/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll b/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll index e2d7100784841..c3371c6ae73d5 100644 --- a/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll +++ b/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp eq i32 %In, 15} +; RUN: opt < %s -instcombine -S | grep {icmp eq i32 %In, 15} ; PR2479 ; (See also PR1800.) diff --git a/test/Transforms/InstCombine/2008-06-24-StackRestore.ll b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll index 9ed7be38c6aa1..830783455189c 100644 --- a/test/Transforms/InstCombine/2008-06-24-StackRestore.ll +++ b/test/Transforms/InstCombine/2008-06-24-StackRestore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*llvm.stackrestore} +; RUN: opt < %s -instcombine -S | grep {call.*llvm.stackrestore} ; PR2488 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" diff --git a/test/Transforms/InstCombine/2008-07-08-AndICmp.ll b/test/Transforms/InstCombine/2008-07-08-AndICmp.ll index c6002413147e6..a12f4bdf1084c 100644 --- a/test/Transforms/InstCombine/2008-07-08-AndICmp.ll +++ b/test/Transforms/InstCombine/2008-07-08-AndICmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp | count 1 +; RUN: opt < %s -instcombine -S | grep icmp | count 1 ; PR2330 define i1 @foo(i32 %a, i32 %b) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll b/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll index 956b9a6ae2e67..8245b4d017b09 100644 --- a/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll +++ b/test/Transforms/InstCombine/2008-07-08-ShiftOneAndOne.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp ne i32 \%a} +; RUN: opt < %s -instcombine -S | grep {icmp ne i32 \%a} ; PR2330 define i1 @foo(i32 %a) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-08-SubAnd.ll b/test/Transforms/InstCombine/2008-07-08-SubAnd.ll index bf3afb9e3bb1d..009115966f584 100644 --- a/test/Transforms/InstCombine/2008-07-08-SubAnd.ll +++ b/test/Transforms/InstCombine/2008-07-08-SubAnd.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v {i32 8} +; RUN: opt < %s -instcombine -S | grep -v {i32 8} ; PR2330 define i32 @a(i32 %a) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll index af728eb207c2e..ccfb1182769f6 100644 --- a/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll +++ b/test/Transforms/InstCombine/2008-07-08-VolatileLoadMerge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} | count 2 +; RUN: opt < %s -instcombine -S | grep {volatile load} | count 2 ; PR2496 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" diff --git a/test/Transforms/InstCombine/2008-07-09-SubAndError.ll b/test/Transforms/InstCombine/2008-07-09-SubAndError.ll index c5b93586ba389..47a7590076c7b 100644 --- a/test/Transforms/InstCombine/2008-07-09-SubAndError.ll +++ b/test/Transforms/InstCombine/2008-07-09-SubAndError.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {sub i32 0} +; RUN: opt < %s -instcombine -S | not grep {sub i32 0} ; PR2330 define i32 @foo(i32 %a) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll b/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll index 205e57d797384..e91153202519a 100644 --- a/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll +++ b/test/Transforms/InstCombine/2008-07-10-CastSextBool.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%C = xor i1 %A, true} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} +; RUN: opt < %s -instcombine -S | grep {%C = xor i1 %A, true} +; RUN: opt < %s -instcombine -S | grep {ret i1 false} ; PR2539 define i1 @test1(i1 %A) { diff --git a/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll b/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll index 50533db06d553..76e30399a6668 100644 --- a/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll +++ b/test/Transforms/InstCombine/2008-07-10-ICmpBinOp.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep add -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep add +; RUN: opt < %s -instcombine -S | not grep mul ; PR2330 define i1 @f(i32 %x, i32 %y) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-11-RemAnd.ll b/test/Transforms/InstCombine/2008-07-11-RemAnd.ll index 0bfd41dd4e7a9..bf53451d66cf7 100644 --- a/test/Transforms/InstCombine/2008-07-11-RemAnd.ll +++ b/test/Transforms/InstCombine/2008-07-11-RemAnd.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem +; RUN: opt < %s -instcombine -S | not grep rem ; PR2330 define i32 @a(i32 %b) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-13-DivZero.ll b/test/Transforms/InstCombine/2008-07-13-DivZero.ll index 85c3dbc5ff693..be1f8c2943750 100644 --- a/test/Transforms/InstCombine/2008-07-13-DivZero.ll +++ b/test/Transforms/InstCombine/2008-07-13-DivZero.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {lshr.*3} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call .*%cond} +; RUN: opt < %s -instcombine -S | grep {lshr.*3} +; RUN: opt < %s -instcombine -S | grep {call .*%cond} ; PR2506 ; We can simplify the operand of udiv to '8', but not the operand to the diff --git a/test/Transforms/InstCombine/2008-07-16-fsub.ll b/test/Transforms/InstCombine/2008-07-16-fsub.ll index ca4174d0a9634..672b4e955262b 100644 --- a/test/Transforms/InstCombine/2008-07-16-fsub.ll +++ b/test/Transforms/InstCombine/2008-07-16-fsub.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub +; RUN: opt < %s -instcombine -S | grep sub ; PR2553 define double @test(double %X) nounwind { diff --git a/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll b/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll index 49e6cdd0377db..501d8a66c3e64 100644 --- a/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll +++ b/test/Transforms/InstCombine/2008-07-16-sse2_storel_dq.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {store } +; RUN: opt < %s -instcombine -S | not grep {store } ; PR2296 @G = common global double 0.000000e+00, align 16 diff --git a/test/Transforms/InstCombine/2008-08-05-And.ll b/test/Transforms/InstCombine/2008-08-05-And.ll index 939e6b8595065..9773c2d76249f 100644 --- a/test/Transforms/InstCombine/2008-08-05-And.ll +++ b/test/Transforms/InstCombine/2008-08-05-And.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or +; RUN: opt < %s -instcombine -S | not grep or ; PR2629 define void @f(i8* %x) nounwind { diff --git a/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll b/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll index 428a35947d1d4..e9081f0fa94cc 100644 --- a/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll +++ b/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor +; RUN: opt < %s -instcombine -S | not grep xor define i1 @test1(i8 %x, i8 %y) { %X = xor i8 %x, 128 diff --git a/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll b/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll index 4b5dc6a5dfc17..7c50141421dcf 100644 --- a/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll +++ b/test/Transforms/InstCombine/2008-09-02-VectorCrash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine define void @entry(i32 %m_task_id, i32 %start_x, i32 %end_x, i32 %start_y, i32 %end_y) { br label %1 diff --git a/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll b/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll index e7a8ca9b521c1..31ea94a5d832c 100644 --- a/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll +++ b/test/Transforms/InstCombine/2008-09-29-FoldingOr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {or i1} +; RUN: opt < %s -instcombine -S | grep {or i1} ; PR2844 define i32 @test(i32 %p_74) { diff --git a/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll index dfe9c4a16c89d..fd36d86a94844 100644 --- a/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll +++ b/test/Transforms/InstCombine/2008-10-11-DivCompareFold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} +; RUN: opt < %s -instcombine -S | grep {ret i1 false} ; PR2697 define i1 @x(i32 %x) nounwind { diff --git a/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll b/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll index 8f35a8586c735..d70d05293e8fc 100644 --- a/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll +++ b/test/Transforms/InstCombine/2008-10-23-ConstFoldWithoutMask.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; PR2940 define i32 @tstid() { diff --git a/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll b/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll index 46e98eb3627c2..aa077e2ac3b32 100644 --- a/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll +++ b/test/Transforms/InstCombine/2008-11-01-SRemDemandedBits.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true} +; RUN: opt < %s -instcombine -S | grep {ret i1 true} ; PR2993 define i1 @foo(i32 %x) { diff --git a/test/Transforms/InstCombine/2008-11-08-FCmp.ll b/test/Transforms/InstCombine/2008-11-08-FCmp.ll index c088f3166fafd..c636288661b1c 100644 --- a/test/Transforms/InstCombine/2008-11-08-FCmp.ll +++ b/test/Transforms/InstCombine/2008-11-08-FCmp.ll @@ -1,9 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t -; RUN: grep {icmp eq} %t -; RUN: grep {ret i1 false} %t | count 2 -; RUN: grep {ret i1 true} %t | count 2 -; RUN: grep {icmp ne} %t -; RUN: not grep {icmp slt} %t +; RUN: opt < %s -instcombine -S | FileCheck %s ; PR3021 ; When inst combining an FCMP with the LHS coming from a uitofp instruction, we @@ -12,6 +7,7 @@ define i1 @test1(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp ole double %1, 0.000000e+00 +; CHECK: icmp eq i32 %val, 0 ret i1 %2 } @@ -19,17 +15,20 @@ define i1 @test2(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp olt double %1, 0.000000e+00 ret i1 %2 +; CHECK: ret i1 false } define i1 @test3(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp oge double %1, 0.000000e+00 ret i1 %2 +; CHECK: ret i1 true } define i1 @test4(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp ogt double %1, 0.000000e+00 +; CHECK: icmp ne i32 %val, 0 ret i1 %2 } @@ -37,10 +36,12 @@ define i1 @test5(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp ogt double %1, -4.400000e+00 ret i1 %2 +; CHECK: ret i1 true } define i1 @test6(i32 %val) { %1 = uitofp i32 %val to double %2 = fcmp olt double %1, -4.400000e+00 ret i1 %2 +; CHECK: ret i1 false } diff --git a/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll index 8c58a2ae7f7d5..b2774d6522dfc 100644 --- a/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll +++ b/test/Transforms/InstCombine/2008-11-20-DivMulRem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: grep urem %t | count 3 ; RUN: grep srem %t | count 1 ; RUN: grep sub %t | count 2 diff --git a/test/Transforms/InstCombine/2008-11-27-IDivVector.ll b/test/Transforms/InstCombine/2008-11-27-IDivVector.ll index 4275e1191a88b..318a80cbc2a47 100644 --- a/test/Transforms/InstCombine/2008-11-27-IDivVector.ll +++ b/test/Transforms/InstCombine/2008-11-27-IDivVector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div +; RUN: opt < %s -instcombine -S | not grep div define <2 x i8> @f(<2 x i8> %x) { %A = udiv <2 x i8> %x, <i8 1, i8 1> diff --git a/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll b/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll index 544e9abbbcb74..d8c53fac49e0d 100644 --- a/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll +++ b/test/Transforms/InstCombine/2008-11-27-MultiplyIntVec.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep mul define <2 x i8> @f(<2 x i8> %x) { %A = mul <2 x i8> %x, <i8 1, i8 1> diff --git a/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll b/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll index 6a6b5f386347a..fc90bba770864 100644 --- a/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll +++ b/test/Transforms/InstCombine/2008-11-27-UDivNegative.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div +; RUN: opt < %s -instcombine -S | not grep div define i8 @test(i8 %x) readnone nounwind { %A = udiv i8 %x, 250 diff --git a/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll b/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll index f970b96ed4d2b..e4c7ebcefc7ef 100644 --- a/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll +++ b/test/Transforms/InstCombine/2008-12-17-SRemNegConstVec.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {i8 2, i8 2} +; RUN: opt < %s -instcombine -S | grep {i8 2, i8 2} ; PR2756 define <2 x i8> @foo(<2 x i8> %x) { diff --git a/test/Transforms/InstCombine/2009-01-05-i128-crash.ll b/test/Transforms/InstCombine/2009-01-05-i128-crash.ll index df3a760daf870..d355e0aff8a7f 100644 --- a/test/Transforms/InstCombine/2009-01-05-i128-crash.ll +++ b/test/Transforms/InstCombine/2009-01-05-i128-crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; PR3235 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll index 82b923ac95c74..a61a94ecbf3a3 100644 --- a/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll +++ b/test/Transforms/InstCombine/2009-01-08-AlignAlloca.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: grep {, align 4} %t | count 3 ; RUN: grep {, align 8} %t | count 3 ; rdar://6480438 diff --git a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll index e0a2610c225e6..ce62f35c10353 100644 --- a/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll +++ b/test/Transforms/InstCombine/2009-01-16-PointerAddrSpace.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store.*addrspace(1)} +; RUN: opt < %s -instcombine -S | grep {store.*addrspace(1)} ; PR3335 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll index cc001f0334c34..79a2f1fd8eb0f 100644 --- a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll +++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float-specials.ll @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x7FF8000000000000 | count 7 -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x7FF00000FFFFFFFF | count 5 -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep {0\\.0} | count 3 -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep {3\\.5} | count 1 +; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x7FF8000000000000 | count 7 +; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x7FF00000FFFFFFFF | count 5 +; RUN: opt < %s -simplifycfg -instcombine -S | grep {0\\.0} | count 3 +; RUN: opt < %s -simplifycfg -instcombine -S | grep {3\\.5} | count 1 ; ; ModuleID = 'apf.c' diff --git a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll index 9cdb425ab49c1..6bc7ce34d1c22 100644 --- a/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll +++ b/test/Transforms/InstCombine/2009-01-19-fmod-constant-float.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0x3FB99999A0000000 | count 2 -; RUN: llvm-as < %s | opt -simplifycfg -instcombine | llvm-dis | grep 0xBFB99999A0000000 | count 2 +; RUN: opt < %s -simplifycfg -instcombine -S | grep 0x3FB99999A0000000 | count 2 +; RUN: opt < %s -simplifycfg -instcombine -S | grep 0xBFB99999A0000000 | count 2 ; check constant folding for 'frem'. PR 3316. ; ModuleID = 'tt.c' diff --git a/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll index 313e76d028d0f..4b64b4872918e 100644 --- a/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll +++ b/test/Transforms/InstCombine/2009-01-24-EmptyStruct.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; PR3381 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" diff --git a/test/Transforms/InstCombine/2009-01-31-InfIterate.ll b/test/Transforms/InstCombine/2009-01-31-InfIterate.ll index 6620e4fadd647..815c1a91936a9 100644 --- a/test/Transforms/InstCombine/2009-01-31-InfIterate.ll +++ b/test/Transforms/InstCombine/2009-01-31-InfIterate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; PR3452 define i128 @test(i64 %A, i64 %B, i1 %C, i128 %Z, i128 %Y, i64* %P, i64* %Q) { entry: diff --git a/test/Transforms/InstCombine/2009-01-31-Pressure.ll b/test/Transforms/InstCombine/2009-01-31-Pressure.ll index 0c3066bb90c9b..c3ee9a35ba397 100644 --- a/test/Transforms/InstCombine/2009-01-31-Pressure.ll +++ b/test/Transforms/InstCombine/2009-01-31-Pressure.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%B = add i8 %b, %x} +; RUN: opt < %s -instcombine -S | grep {%B = add i8 %b, %x} ; PR2698 declare void @use1(i1) diff --git a/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll b/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll index b08c9622502aa..bc6a2045fa0cf 100644 --- a/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll +++ b/test/Transforms/InstCombine/2009-02-04-FPBitcast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; PR3468 define x86_fp80 @cast() { diff --git a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll index 52bceadac3954..b29d8d23bc07f 100644 --- a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll +++ b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -scalarrepl | llvm-dis | not grep { = alloca} +; RUN: opt < %s -instcombine -scalarrepl -S | not grep { = alloca} ; rdar://6417724 ; Instcombine shouldn't do anything to this function that prevents promoting the allocas inside it. diff --git a/test/Transforms/InstCombine/2009-02-21-LoadCST.ll b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll index 2c126df1f14d0..f56fc388eb5b0 100644 --- a/test/Transforms/InstCombine/2009-02-21-LoadCST.ll +++ b/test/Transforms/InstCombine/2009-02-21-LoadCST.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 3679669} +; RUN: opt < %s -instcombine -S | grep {ret i32 3679669} ; PR3595 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll index c59c5edcf2d16..a8349f042e42c 100644 --- a/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll +++ b/test/Transforms/InstCombine/2009-02-25-CrashZeroSizeArray.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; PR3667 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" diff --git a/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll index ae690cf9a519f..c617ca4fcad3f 100644 --- a/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll +++ b/test/Transforms/InstCombine/2009-03-18-vector-ashr-crash.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; PR3826 define void @0(<4 x i16>*, <4 x i16>*) { diff --git a/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll b/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll index 92ace11f8f398..0a07bf34bac91 100644 --- a/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll +++ b/test/Transforms/InstCombine/2009-03-20-AShrOverShift.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ashr i32 %val, 31} +; RUN: opt < %s -instcombine -S | grep {ashr i32 %val, 31} ; PR3851 define i32 @foo2(i32 %val) nounwind { diff --git a/test/Transforms/InstCombine/2009-03-24-InfLoop.ll b/test/Transforms/InstCombine/2009-03-24-InfLoop.ll index 6d5a7bf77d2b3..4ce04a1eb5429 100644 --- a/test/Transforms/InstCombine/2009-03-24-InfLoop.ll +++ b/test/Transforms/InstCombine/2009-03-24-InfLoop.ll @@ -1,5 +1,5 @@ ; PR3874 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis define i1 @test(i32 %x) { %A = lshr i32 3968, %x %B = and i32 %A, 1 diff --git a/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll b/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll index 82f8762981915..244b22a14dec0 100644 --- a/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll +++ b/test/Transforms/InstCombine/2009-04-07-MulPromoteToI96.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {mul i64} +; RUN: opt < %s -instcombine -S | grep {mul i64} ; rdar://6762288 ; Instcombine should not promote the mul to i96 because it is definitely diff --git a/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll index 1eda7dfa9ec74..dd14c6beec4c6 100644 --- a/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll +++ b/test/Transforms/InstCombine/2009-05-23-FCmpToICmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep cmp +; RUN: opt < %s -instcombine -S | not grep cmp ; rdar://6903175 define i1 @f0(i32 *%a) nounwind { diff --git a/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll b/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll index ffb55a7921485..e5355b8d3c56b 100644 --- a/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll +++ b/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {store i32 0,} +; RUN: opt < %s -instcombine -S | grep {store i32 0,} ; PR4366 define void @a() { diff --git a/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll b/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll index 82b223a4ddc94..6beedf83cd6a2 100644 --- a/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll +++ b/test/Transforms/InstCombine/2009-06-16-SRemDemandedBits.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem +; RUN: opt < %s -instcombine -S | grep srem ; PR3439 define i32 @a(i32 %x) nounwind { diff --git a/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll b/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll index 7505de17a7afc..41940fe885e5d 100644 --- a/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll +++ b/test/Transforms/InstCombine/2009-07-02-MaskedIntVector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; PR4495 define i32 @test(i64 %test) { diff --git a/test/Transforms/InstCombine/CPP_min_max.ll b/test/Transforms/InstCombine/CPP_min_max.ll index 785b91e79e49a..531ce2b07b306 100644 --- a/test/Transforms/InstCombine/CPP_min_max.ll +++ b/test/Transforms/InstCombine/CPP_min_max.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep select | not grep {i32\\*} ; This testcase corresponds to PR362, which notices that this horrible code diff --git a/test/Transforms/InstCombine/IntPtrCast.ll b/test/Transforms/InstCombine/IntPtrCast.ll index e24d199f8c45a..4ecbccd86a48d 100644 --- a/test/Transforms/InstCombine/IntPtrCast.ll +++ b/test/Transforms/InstCombine/IntPtrCast.ll @@ -1,9 +1,10 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s target datalayout = "e-p:32:32" define i32* @test(i32* %P) { %V = ptrtoint i32* %P to i32 ; <i32> [#uses=1] %P2 = inttoptr i32 %V to i32* ; <i32*> [#uses=1] ret i32* %P2 +; CHECK: ret i32* %P } diff --git a/test/Transforms/InstCombine/JavaCompare.ll b/test/Transforms/InstCombine/JavaCompare.ll index 72cab427d07f5..7d0edb84d1eb5 100644 --- a/test/Transforms/InstCombine/JavaCompare.ll +++ b/test/Transforms/InstCombine/JavaCompare.ll @@ -1,7 +1,7 @@ ; This is the sequence of stuff that the Java front-end expands for a single ; <= comparison. Check to make sure we turn it into a <= (only) -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {%c3 = icmp sle i32 %A, %B} +; RUN: opt < %s -instcombine -S | grep {%c3 = icmp sle i32 %A, %B} define i1 @le(i32 %A, i32 %B) { %c1 = icmp sgt i32 %A, %B ; <i1> [#uses=1] diff --git a/test/Transforms/InstCombine/add-shrink.ll b/test/Transforms/InstCombine/add-shrink.ll index 6dc02f361c97f..52b8e327dbaee 100644 --- a/test/Transforms/InstCombine/add-shrink.ll +++ b/test/Transforms/InstCombine/add-shrink.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sext | count 1 +; RUN: opt < %s -instcombine -S | grep {add i32} +; RUN: opt < %s -instcombine -S | grep sext | count 1 ; Should only have one sext and the add should be i32 instead of i64. diff --git a/test/Transforms/InstCombine/add-sitofp.ll b/test/Transforms/InstCombine/add-sitofp.ll index 298b9a1917afd..24319df0b7620 100644 --- a/test/Transforms/InstCombine/add-sitofp.ll +++ b/test/Transforms/InstCombine/add-sitofp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add i32} +; RUN: opt < %s -instcombine -S | grep {add i32} define double @x(i32 %a, i32 %b) nounwind { %m = lshr i32 %a, 24 diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll index 6ff2187474f75..4719809d6d369 100644 --- a/test/Transforms/InstCombine/add.ll +++ b/test/Transforms/InstCombine/add.ll @@ -1,6 +1,6 @@ ; This test makes sure that add instructions are properly eliminated. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v OK | not grep add define i32 @test1(i32 %A) { diff --git a/test/Transforms/InstCombine/add2.ll b/test/Transforms/InstCombine/add2.ll index 161d56b40b572..1cbdd3a3cd54f 100644 --- a/test/Transforms/InstCombine/add2.ll +++ b/test/Transforms/InstCombine/add2.ll @@ -1,9 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v OK | not grep add - -;; Target triple for gep raising case below. -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" +; RUN: opt < %s -instcombine -S | not grep add define i64 @test1(i64 %A, i32 %B) { %tmp12 = zext i32 %B to i64 @@ -13,23 +8,6 @@ define i64 @test1(i64 %A, i32 %B) { ret i64 %tmp6 } -; PR1795 -define void @test2(i32 %.val24) { -EntryBlock: - add i32 %.val24, -12 - inttoptr i32 %0 to i32* - store i32 1, i32* %1 - add i32 %.val24, -16 - inttoptr i32 %2 to i32* - getelementptr i32* %3, i32 1 - load i32* %4 - tail call i32 @callee( i32 %5 ) - ret void -} - -declare i32 @callee(i32) - - define i32 @test3(i32 %A) { %B = and i32 %A, 7 %C = and i32 %A, 32 diff --git a/test/Transforms/InstCombine/add3.ll b/test/Transforms/InstCombine/add3.ll new file mode 100644 index 0000000000000..cde3e24215f8b --- /dev/null +++ b/test/Transforms/InstCombine/add3.ll @@ -0,0 +1,21 @@ +; RUN: opt < %s -instcombine -S | grep inttoptr | count 2 + +;; Target triple for gep raising case below. +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" + +; PR1795 +define void @test2(i32 %.val24) { +EntryBlock: + add i32 %.val24, -12 + inttoptr i32 %0 to i32* + store i32 1, i32* %1 + add i32 %.val24, -16 + inttoptr i32 %2 to i32* + getelementptr i32* %3, i32 1 + load i32* %4 + tail call i32 @callee( i32 %5 ) + ret void +} + +declare i32 @callee(i32) diff --git a/test/Transforms/InstCombine/addnegneg.ll b/test/Transforms/InstCombine/addnegneg.ll index f3b9565a51e11..a3a09f27ed957 100644 --- a/test/Transforms/InstCombine/addnegneg.ll +++ b/test/Transforms/InstCombine/addnegneg.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep { sub } | count 1 +; RUN: opt < %s -instcombine -S | grep { sub } | count 1 ; PR2047 define i32 @l(i32 %a, i32 %b, i32 %c, i32 %d) { diff --git a/test/Transforms/InstCombine/adjust-for-sminmax.ll b/test/Transforms/InstCombine/adjust-for-sminmax.ll index 9328ad3649953..b9b6f702eb627 100644 --- a/test/Transforms/InstCombine/adjust-for-sminmax.ll +++ b/test/Transforms/InstCombine/adjust-for-sminmax.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp s\[lg\]t i32 %n, 0} | count 16 +; RUN: opt < %s -instcombine -S | grep {icmp s\[lg\]t i32 %n, 0} | count 16 ; Instcombine should recognize that this code can be adjusted ; to fit the canonical smax/smin pattern. diff --git a/test/Transforms/InstCombine/align-2d-gep.ll b/test/Transforms/InstCombine/align-2d-gep.ll index c826e31da1f97..80aacbce130ec 100644 --- a/test/Transforms/InstCombine/align-2d-gep.ll +++ b/test/Transforms/InstCombine/align-2d-gep.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 16} | count 1 +; RUN: opt < %s -instcombine -S | grep {align 16} | count 1 ; A multi-dimensional array in a nested loop doing vector stores that ; aren't yet aligned. Instcombine can understand the addressing in the diff --git a/test/Transforms/InstCombine/align-addr.ll b/test/Transforms/InstCombine/align-addr.ll index a05c513dcbb3c..425393711625e 100644 --- a/test/Transforms/InstCombine/align-addr.ll +++ b/test/Transforms/InstCombine/align-addr.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 16} | count 1 +; RUN: opt < %s -instcombine -S | grep {align 16} | count 1 ; Instcombine should be able to prove vector alignment in the ; presence of a few mild address computation tricks. diff --git a/test/Transforms/InstCombine/align-external.ll b/test/Transforms/InstCombine/align-external.ll new file mode 100644 index 0000000000000..6e8ad87f19e05 --- /dev/null +++ b/test/Transforms/InstCombine/align-external.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; Don't assume that external global variables have their preferred +; alignment. They may only have the ABI minimum alignment. + +; CHECK: %s = shl i64 %a, 3 +; CHECK: %r = or i64 %s, ptrtoint (i32* @A to i64) +; CHECK: %q = add i64 %r, 1 +; CHECK: ret i64 %q + +target datalayout = "-i32:8:32" + +@A = external global i32 +@B = external global i32 + +define i64 @foo(i64 %a) { + %t = ptrtoint i32* @A to i64 + %s = shl i64 %a, 3 + %r = or i64 %t, %s + %q = add i64 %r, 1 + ret i64 %q +} diff --git a/test/Transforms/InstCombine/align-inc.ll b/test/Transforms/InstCombine/align-inc.ll index 104d9918a9c70..0260ca2c65f54 100644 --- a/test/Transforms/InstCombine/align-inc.ll +++ b/test/Transforms/InstCombine/align-inc.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {GLOBAL.*align 16} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {tmp = load} +; RUN: opt < %s -instcombine -S | grep {GLOBAL.*align 16} +; RUN: opt < %s -instcombine -S | grep {tmp = load} @GLOBAL = internal global [4 x i32] zeroinitializer diff --git a/test/Transforms/InstCombine/alloca.ll b/test/Transforms/InstCombine/alloca.ll index 95d0f094ae3f2..13d664d559991 100644 --- a/test/Transforms/InstCombine/alloca.ll +++ b/test/Transforms/InstCombine/alloca.ll @@ -1,6 +1,6 @@ ; Zero byte allocas should be deleted. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep alloca ; END. diff --git a/test/Transforms/InstCombine/and-compare.ll b/test/Transforms/InstCombine/and-compare.ll index d2f2753f887ed..c30a245e41565 100644 --- a/test/Transforms/InstCombine/and-compare.ll +++ b/test/Transforms/InstCombine/and-compare.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep and | count 1 ; Should be optimized to one and. diff --git a/test/Transforms/InstCombine/and-fcmp.ll b/test/Transforms/InstCombine/and-fcmp.ll index 55efffa34ff5f..91868d1d07591 100644 --- a/test/Transforms/InstCombine/and-fcmp.ll +++ b/test/Transforms/InstCombine/and-fcmp.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fcmp | count 3 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | grep 0 +; RUN: opt < %s -instcombine -S | grep fcmp | count 3 +; RUN: opt < %s -instcombine -S | grep ret | grep 0 define zeroext i8 @t1(float %x, float %y) nounwind { %a = fcmp ueq float %x, %y diff --git a/test/Transforms/InstCombine/and-not-or.ll b/test/Transforms/InstCombine/and-not-or.ll index 9e9f397c4be32..9dce7b4e6fb39 100644 --- a/test/Transforms/InstCombine/and-not-or.ll +++ b/test/Transforms/InstCombine/and-not-or.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %x, %y} | count 4 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or} +; RUN: opt < %s -instcombine -S | grep {and i32 %x, %y} | count 4 +; RUN: opt < %s -instcombine -S | not grep {or} define i32 @func1(i32 %x, i32 %y) nounwind { entry: diff --git a/test/Transforms/InstCombine/and-or-and.ll b/test/Transforms/InstCombine/and-or-and.ll index 04d475ccd8229..216cd46775a5f 100644 --- a/test/Transforms/InstCombine/and-or-and.ll +++ b/test/Transforms/InstCombine/and-or-and.ll @@ -9,7 +9,7 @@ ; ; Which corresponds to test1. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {or } define i32 @test1(i32 %X, i32 %Y) { diff --git a/test/Transforms/InstCombine/and-or-not.ll b/test/Transforms/InstCombine/and-or-not.ll index 8fc53a7e0acbc..37ec3bc1aabbe 100644 --- a/test/Transforms/InstCombine/and-or-not.ll +++ b/test/Transforms/InstCombine/and-or-not.ll @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 4 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep { or} +; RUN: opt < %s -instcombine -S | grep xor | count 4 +; RUN: opt < %s -instcombine -S | not grep and +; RUN: opt < %s -instcombine -S | not grep { or} ; PR1510 diff --git a/test/Transforms/InstCombine/and-or.ll b/test/Transforms/InstCombine/and-or.ll index 38ad842e015f5..b4224b38b1c24 100644 --- a/test/Transforms/InstCombine/and-or.ll +++ b/test/Transforms/InstCombine/and-or.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {and i32 %a, 1} | count 4 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {or i32 %0, %b} | count 4 +; RUN: opt < %s -instcombine -S | grep {and i32 %a, 1} | count 4 +; RUN: opt < %s -instcombine -S | grep {or i32 %0, %b} | count 4 define i32 @func1(i32 %a, i32 %b) nounwind readnone { diff --git a/test/Transforms/InstCombine/and-xor-merge.ll b/test/Transforms/InstCombine/and-xor-merge.ll index 85f8026ab5721..e432a9aef7d14 100644 --- a/test/Transforms/InstCombine/and-xor-merge.ll +++ b/test/Transforms/InstCombine/and-xor-merge.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 1 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 2 +; RUN: opt < %s -instcombine -S | grep and | count 1 +; RUN: opt < %s -instcombine -S | grep xor | count 2 ; (x&z) ^ (y&z) -> (x^y)&z define i32 @test1(i32 %x, i32 %y, i32 %z) { diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll index edab47e87cf12..8492df9a1209c 100644 --- a/test/Transforms/InstCombine/and.ll +++ b/test/Transforms/InstCombine/and.ll @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and +; RUN: opt < %s -instcombine -S | not grep and define i32 @test1(i32 %A) { ; zero result diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll index 3b80d94e1a61c..0af9bfaff3941 100644 --- a/test/Transforms/InstCombine/and2.ll +++ b/test/Transforms/InstCombine/and2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and +; RUN: opt < %s -instcombine -S | not grep and ; PR1738 diff --git a/test/Transforms/InstCombine/apint-add1.ll b/test/Transforms/InstCombine/apint-add1.ll index 74280ee7f7cad..02f1baf539967 100644 --- a/test/Transforms/InstCombine/apint-add1.ll +++ b/test/Transforms/InstCombine/apint-add1.ll @@ -1,7 +1,7 @@ ; This test makes sure that add instructions are properly eliminated. ; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v OK | not grep add diff --git a/test/Transforms/InstCombine/apint-add2.ll b/test/Transforms/InstCombine/apint-add2.ll index 0ddfcc0764d6c..913a70f1b458f 100644 --- a/test/Transforms/InstCombine/apint-add2.ll +++ b/test/Transforms/InstCombine/apint-add2.ll @@ -1,7 +1,7 @@ ; This test makes sure that add instructions are properly eliminated. ; This test is for Integer BitWidth > 64 && BitWidth <= 1024. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v OK | not grep add ; END. diff --git a/test/Transforms/InstCombine/apint-and-compare.ll b/test/Transforms/InstCombine/apint-and-compare.ll index ad2e41d718efe..53e591e69c9df 100644 --- a/test/Transforms/InstCombine/apint-and-compare.ll +++ b/test/Transforms/InstCombine/apint-and-compare.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 2 +; RUN: opt < %s -instcombine -S | grep and | count 2 ; Should be optimized to one and. define i1 @test1(i33 %a, i33 %b) { diff --git a/test/Transforms/InstCombine/apint-and-or-and.ll b/test/Transforms/InstCombine/apint-and-or-and.ll index 4630f28678653..17d29b601e69e 100644 --- a/test/Transforms/InstCombine/apint-and-or-and.ll +++ b/test/Transforms/InstCombine/apint-and-or-and.ll @@ -11,7 +11,7 @@ ; ; This tests arbitrary precision integers. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {or } +; RUN: opt < %s -instcombine -S | not grep {or } ; END. define i17 @test1(i17 %X, i17 %Y) { diff --git a/test/Transforms/InstCombine/apint-and-xor-merge.ll b/test/Transforms/InstCombine/apint-and-xor-merge.ll index e1e4e3caaef0f..8adffde362735 100644 --- a/test/Transforms/InstCombine/apint-and-xor-merge.ll +++ b/test/Transforms/InstCombine/apint-and-xor-merge.ll @@ -1,8 +1,8 @@ ; This test case checks that the merge of and/xor can work on arbitrary ; precision integers. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep and | count 1 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | count 2 +; RUN: opt < %s -instcombine -S | grep and | count 1 +; RUN: opt < %s -instcombine -S | grep xor | count 2 ; (x &z ) ^ (y & z) -> (x ^ y) & z define i57 @test1(i57 %x, i57 %y, i57 %z) { diff --git a/test/Transforms/InstCombine/apint-and1.ll b/test/Transforms/InstCombine/apint-and1.ll index eb3b1a64b2ce0..cd4cbb9cf4544 100644 --- a/test/Transforms/InstCombine/apint-and1.ll +++ b/test/Transforms/InstCombine/apint-and1.ll @@ -1,7 +1,7 @@ ; This test makes sure that and instructions are properly eliminated. ; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and } +; RUN: opt < %s -instcombine -S | not grep {and } ; END. define i39 @test0(i39 %A) { diff --git a/test/Transforms/InstCombine/apint-and2.ll b/test/Transforms/InstCombine/apint-and2.ll index f7b3934d5b83d..ae74472b3d086 100644 --- a/test/Transforms/InstCombine/apint-and2.ll +++ b/test/Transforms/InstCombine/apint-and2.ll @@ -1,7 +1,7 @@ ; This test makes sure that and instructions are properly eliminated. ; This test is for Integer BitWidth > 64 && BitWidth <= 1024. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and } +; RUN: opt < %s -instcombine -S | not grep {and } ; END. diff --git a/test/Transforms/InstCombine/apint-call-cast-target.ll b/test/Transforms/InstCombine/apint-call-cast-target.ll index 3688fbe1f2939..fe336de752424 100644 --- a/test/Transforms/InstCombine/apint-call-cast-target.ll +++ b/test/Transforms/InstCombine/apint-call-cast-target.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep call | not grep bitcast +; RUN: opt < %s -instcombine -S | grep call | not grep bitcast target datalayout = "e-p:32:32" target triple = "i686-pc-linux-gnu" diff --git a/test/Transforms/InstCombine/apint-cast-and-cast.ll b/test/Transforms/InstCombine/apint-cast-and-cast.ll index 337fd7c2d722d..251d78f59bee5 100644 --- a/test/Transforms/InstCombine/apint-cast-and-cast.ll +++ b/test/Transforms/InstCombine/apint-cast-and-cast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast +; RUN: opt < %s -instcombine -S | not grep bitcast define i19 @test1(i43 %val) { %t1 = bitcast i43 %val to i43 diff --git a/test/Transforms/InstCombine/apint-cast-cast-to-and.ll b/test/Transforms/InstCombine/apint-cast-cast-to-and.ll index 29a88694d5c56..b2069a93ac4c8 100644 --- a/test/Transforms/InstCombine/apint-cast-cast-to-and.ll +++ b/test/Transforms/InstCombine/apint-cast-cast-to-and.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep i41 +; RUN: opt < %s -instcombine -S | not grep i41 define i61 @test1(i61 %X) { %Y = trunc i61 %X to i41 ;; Turn i61o an AND diff --git a/test/Transforms/InstCombine/apint-cast.ll b/test/Transforms/InstCombine/apint-cast.ll index dd00146400212..9bc539ed8b23a 100644 --- a/test/Transforms/InstCombine/apint-cast.ll +++ b/test/Transforms/InstCombine/apint-cast.ll @@ -1,20 +1,28 @@ ; Tests to make sure elimination of casts is working correctly -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i17 @test1(i17 %a) { %tmp = zext i17 %a to i37 ; <i37> [#uses=2] %tmp21 = lshr i37 %tmp, 8 ; <i37> [#uses=1] +; CHECK: %tmp21 = lshr i17 %a, 8 %tmp5 = shl i37 %tmp, 8 ; <i37> [#uses=1] +; CHECK: %tmp5 = shl i17 %a, 8 %tmp.upgrd.32 = or i37 %tmp21, %tmp5 ; <i37> [#uses=1] +; CHECK: %tmp.upgrd.32 = or i17 %tmp21, %tmp5 %tmp.upgrd.3 = trunc i37 %tmp.upgrd.32 to i17 ; <i17> [#uses=1] ret i17 %tmp.upgrd.3 +; CHECK: ret i17 %tmp.upgrd.32 } define i167 @test2(i167 %a) { %tmp = zext i167 %a to i577 ; <i577> [#uses=2] %tmp21 = lshr i577 %tmp, 9 ; <i577> [#uses=1] +; CHECK: %tmp21 = lshr i167 %a, 9 %tmp5 = shl i577 %tmp, 8 ; <i577> [#uses=1] +; CHECK: %tmp5 = shl i167 %a, 8 %tmp.upgrd.32 = or i577 %tmp21, %tmp5 ; <i577> [#uses=1] +; CHECK: %tmp.upgrd.32 = or i167 %tmp21, %tmp5 %tmp.upgrd.3 = trunc i577 %tmp.upgrd.32 to i167 ; <i167> [#uses=1] ret i167 %tmp.upgrd.3 +; CHECK: ret i167 %tmp.upgrd.32 } diff --git a/test/Transforms/InstCombine/apint-div1.ll b/test/Transforms/InstCombine/apint-div1.ll index e9aa579b95835..68aadac1de44f 100644 --- a/test/Transforms/InstCombine/apint-div1.ll +++ b/test/Transforms/InstCombine/apint-div1.ll @@ -1,7 +1,7 @@ ; This test makes sure that div instructions are properly eliminated. ; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div +; RUN: opt < %s -instcombine -S | not grep div define i33 @test1(i33 %X) { diff --git a/test/Transforms/InstCombine/apint-div2.ll b/test/Transforms/InstCombine/apint-div2.ll index 2aa2c3a4ac2c3..2d7ac78a210fc 100644 --- a/test/Transforms/InstCombine/apint-div2.ll +++ b/test/Transforms/InstCombine/apint-div2.ll @@ -1,7 +1,7 @@ ; This test makes sure that div instructions are properly eliminated. ; This test is for Integer BitWidth >= 64 && BitWidth <= 1024. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div +; RUN: opt < %s -instcombine -S | not grep div define i333 @test1(i333 %X) { diff --git a/test/Transforms/InstCombine/apint-elim-logicalops.ll b/test/Transforms/InstCombine/apint-elim-logicalops.ll index 13d032cacf21e..ec60e45d54916 100644 --- a/test/Transforms/InstCombine/apint-elim-logicalops.ll +++ b/test/Transforms/InstCombine/apint-elim-logicalops.ll @@ -1,6 +1,6 @@ ; Test that elimination of logical operators works with ; arbitrary precision integers. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {(and\|xor\|add\|shl\|shr)} ; END. diff --git a/test/Transforms/InstCombine/apint-mul1.ll b/test/Transforms/InstCombine/apint-mul1.ll index 36b1102580c96..6a5b3e7f03c84 100644 --- a/test/Transforms/InstCombine/apint-mul1.ll +++ b/test/Transforms/InstCombine/apint-mul1.ll @@ -2,7 +2,7 @@ ; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep mul define i17 @test1(i17 %X) { diff --git a/test/Transforms/InstCombine/apint-mul2.ll b/test/Transforms/InstCombine/apint-mul2.ll index 72fd97ac79f0a..558d2fb63c1e3 100644 --- a/test/Transforms/InstCombine/apint-mul2.ll +++ b/test/Transforms/InstCombine/apint-mul2.ll @@ -2,7 +2,7 @@ ; This test is for Integer BitWidth >= 64 && BitWidth % 2 >= 1024. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep mul define i177 @test1(i177 %X) { diff --git a/test/Transforms/InstCombine/apint-not.ll b/test/Transforms/InstCombine/apint-not.ll index f557fa8b1788f..488b7f2c98e18 100644 --- a/test/Transforms/InstCombine/apint-not.ll +++ b/test/Transforms/InstCombine/apint-not.ll @@ -1,7 +1,7 @@ ; This test makes sure that the xor instructions are properly eliminated ; when arbitrary precision integers are used. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor +; RUN: opt < %s -instcombine -S | not grep xor define i33 @test1(i33 %A) { %B = xor i33 %A, -1 diff --git a/test/Transforms/InstCombine/apint-or1.ll b/test/Transforms/InstCombine/apint-or1.ll index 51b87fe2a2007..d4f87ac894d98 100644 --- a/test/Transforms/InstCombine/apint-or1.ll +++ b/test/Transforms/InstCombine/apint-or1.ll @@ -2,7 +2,7 @@ ; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or +; RUN: opt < %s -instcombine -S | not grep or define i7 @test0(i7 %X) { diff --git a/test/Transforms/InstCombine/apint-or2.ll b/test/Transforms/InstCombine/apint-or2.ll index 21dc5654ceeca..d7de255f7fd2b 100644 --- a/test/Transforms/InstCombine/apint-or2.ll +++ b/test/Transforms/InstCombine/apint-or2.ll @@ -1,7 +1,7 @@ ; This test makes sure that or instructions are properly eliminated. ; This test is for Integer BitWidth > 64 && BitWidth <= 1024. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep or +; RUN: opt < %s -instcombine -S | not grep or define i777 @test0(i777 %X) { diff --git a/test/Transforms/InstCombine/apint-rem1.ll b/test/Transforms/InstCombine/apint-rem1.ll index 2ec8c749972d5..030faccee8b43 100644 --- a/test/Transforms/InstCombine/apint-rem1.ll +++ b/test/Transforms/InstCombine/apint-rem1.ll @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; This test is for Integer BitWidth < 64 && BitWidth % 2 != 0. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem +; RUN: opt < %s -instcombine -S | not grep rem define i33 @test1(i33 %A) { diff --git a/test/Transforms/InstCombine/apint-rem2.ll b/test/Transforms/InstCombine/apint-rem2.ll index 4d22c22d54010..9bfc4cde9521c 100644 --- a/test/Transforms/InstCombine/apint-rem2.ll +++ b/test/Transforms/InstCombine/apint-rem2.ll @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; This test is for Integer BitWidth >= 64 && BitWidth <= 1024. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem +; RUN: opt < %s -instcombine -S | not grep rem define i333 @test1(i333 %A) { diff --git a/test/Transforms/InstCombine/apint-select.ll b/test/Transforms/InstCombine/apint-select.ll index c2399fb88efeb..f2ea60101c5f9 100644 --- a/test/Transforms/InstCombine/apint-select.ll +++ b/test/Transforms/InstCombine/apint-select.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select +; RUN: opt < %s -instcombine -S | not grep select define i41 @test1(i1 %C) { diff --git a/test/Transforms/InstCombine/apint-shift-simplify.ll b/test/Transforms/InstCombine/apint-shift-simplify.ll index a0046fbacb6bd..1a3340ac56675 100644 --- a/test/Transforms/InstCombine/apint-shift-simplify.ll +++ b/test/Transforms/InstCombine/apint-shift-simplify.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: egrep {shl|lshr|ashr} | count 3 define i41 @test0(i41 %A, i41 %B, i41 %C) { diff --git a/test/Transforms/InstCombine/apint-shift.ll b/test/Transforms/InstCombine/apint-shift.ll index afc5360d8de44..6573b5bf4f44f 100644 --- a/test/Transforms/InstCombine/apint-shift.ll +++ b/test/Transforms/InstCombine/apint-shift.ll @@ -1,6 +1,6 @@ ; This test makes sure that shit instructions are properly eliminated ; even with arbitrary precision integers. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh +; RUN: opt < %s -instcombine -S | not grep sh ; END. define i47 @test1(i47 %A) { diff --git a/test/Transforms/InstCombine/apint-shl-trunc.ll b/test/Transforms/InstCombine/apint-shl-trunc.ll index a9cffdef04f43..8163e6d527d77 100644 --- a/test/Transforms/InstCombine/apint-shl-trunc.ll +++ b/test/Transforms/InstCombine/apint-shl-trunc.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shl +; RUN: opt < %s -instcombine -S | grep shl ; END. define i1 @test0(i39 %X, i39 %A) { diff --git a/test/Transforms/InstCombine/apint-sub.ll b/test/Transforms/InstCombine/apint-sub.ll index 2ff763c9f5f89..8b9ff143ea4e2 100644 --- a/test/Transforms/InstCombine/apint-sub.ll +++ b/test/Transforms/InstCombine/apint-sub.ll @@ -2,7 +2,7 @@ ; even with arbitrary precision integers. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v {sub i19 %Cok, %Bok} | grep -v {sub i25 0, %Aok} | not grep sub ; END. diff --git a/test/Transforms/InstCombine/apint-xor1.ll b/test/Transforms/InstCombine/apint-xor1.ll index 5ddf5cf9c9b6b..849c659833282 100644 --- a/test/Transforms/InstCombine/apint-xor1.ll +++ b/test/Transforms/InstCombine/apint-xor1.ll @@ -1,7 +1,7 @@ ; This test makes sure that xor instructions are properly eliminated. ; This test is for Integer BitWidth <= 64 && BitWidth % 8 != 0. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor } +; RUN: opt < %s -instcombine -S | not grep {xor } define i47 @test1(i47 %A, i47 %B) { diff --git a/test/Transforms/InstCombine/apint-xor2.ll b/test/Transforms/InstCombine/apint-xor2.ll index 4d2d415f34677..cacc17958eb9d 100644 --- a/test/Transforms/InstCombine/apint-xor2.ll +++ b/test/Transforms/InstCombine/apint-xor2.ll @@ -1,7 +1,7 @@ ; This test makes sure that xor instructions are properly eliminated. ; This test is for Integer BitWidth > 64 && BitWidth <= 1024. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor } +; RUN: opt < %s -instcombine -S | not grep {xor } ; END. diff --git a/test/Transforms/InstCombine/apint-zext1.ll b/test/Transforms/InstCombine/apint-zext1.ll index 03330c7be966f..40de360bb692f 100644 --- a/test/Transforms/InstCombine/apint-zext1.ll +++ b/test/Transforms/InstCombine/apint-zext1.ll @@ -1,9 +1,11 @@ ; Tests to make sure elimination of casts is working correctly ; This test is for Integer BitWidth <= 64 && BitWidth % 2 != 0. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*} +; RUN: opt < %s -instcombine -S | FileCheck %s define i47 @test_sext_zext(i11 %A) { %c1 = zext i11 %A to i39 %c2 = sext i39 %c1 to i47 ret i47 %c2 +; CHECK: %c2 = zext i11 %A to i47 +; CHECK: ret i47 %c2 } diff --git a/test/Transforms/InstCombine/apint-zext2.ll b/test/Transforms/InstCombine/apint-zext2.ll index 8350d10282b69..886dcf2826cc5 100644 --- a/test/Transforms/InstCombine/apint-zext2.ll +++ b/test/Transforms/InstCombine/apint-zext2.ll @@ -1,9 +1,11 @@ ; Tests to make sure elimination of casts is working correctly ; This test is for Integer BitWidth > 64 && BitWidth <= 1024. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast {} {%c1.*} +; RUN: opt < %s -instcombine -S | FileCheck %s define i1024 @test_sext_zext(i77 %A) { %c1 = zext i77 %A to i533 %c2 = sext i533 %c1 to i1024 ret i1024 %c2 +; CHECK: %c2 = zext i77 %A to i1024 +; CHECK: ret i1024 %c2 } diff --git a/test/Transforms/InstCombine/ashr-nop.ll b/test/Transforms/InstCombine/ashr-nop.ll index bb0da346b0c1a..870ede38cd888 100644 --- a/test/Transforms/InstCombine/ashr-nop.ll +++ b/test/Transforms/InstCombine/ashr-nop.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr +; RUN: opt < %s -instcombine -S | not grep ashr define i32 @foo(i32 %x) { %o = and i32 %x, 1 diff --git a/test/Transforms/InstCombine/badmalloc.ll b/test/Transforms/InstCombine/badmalloc.ll new file mode 100644 index 0000000000000..cab23b5af5993 --- /dev/null +++ b/test/Transforms/InstCombine/badmalloc.ll @@ -0,0 +1,19 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-apple-darwin10.0" + +declare noalias i8* @malloc(i64) nounwind +declare void @free(i8*) + +; PR5130 +define i1 @test1() { + %A = call noalias i8* @malloc(i64 4) nounwind + %B = icmp eq i8* %A, null + + call void @free(i8* %A) + ret i1 %B + +; CHECK: @test1 +; CHECK: ret i1 %B +} diff --git a/test/Transforms/InstCombine/binop-cast.ll b/test/Transforms/InstCombine/binop-cast.ll index ea5299ba87612..3dbca7ef14899 100644 --- a/test/Transforms/InstCombine/binop-cast.ll +++ b/test/Transforms/InstCombine/binop-cast.ll @@ -1,7 +1,9 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @testAdd(i32 %X, i32 %Y) { %tmp = add i32 %X, %Y +; CHECK: %tmp = add i32 %X, %Y %tmp.l = bitcast i32 %tmp to i32 ret i32 %tmp.l +; CHECK: ret i32 %tmp } diff --git a/test/Transforms/InstCombine/bit-tracking.ll b/test/Transforms/InstCombine/bit-tracking.ll index d090c69d7f3c3..51bbc0888836e 100644 --- a/test/Transforms/InstCombine/bit-tracking.ll +++ b/test/Transforms/InstCombine/bit-tracking.ll @@ -1,6 +1,6 @@ ; This file contains various testcases that require tracking whether bits are ; set or cleared by various instructions. -; RUN: llvm-as < %s | opt -instcombine -instcombine | llvm-dis |\ +; RUN: opt < %s -instcombine -instcombine -S |\ ; RUN: not grep %ELIM ; Reduce down to a single XOR diff --git a/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll b/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll index 8695d1edbc139..4e9dfbb53b496 100644 --- a/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll +++ b/test/Transforms/InstCombine/bitcast-scalar-to-vector.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0} +; RUN: opt < %s -instcombine -S | grep {ret i32 0} ; PR4487 ; Bitcasts between vectors and scalars are valid, despite being ill-advised. diff --git a/test/Transforms/InstCombine/bitcast-vec-canon.ll b/test/Transforms/InstCombine/bitcast-vec-canon.ll new file mode 100644 index 0000000000000..d27765e89424f --- /dev/null +++ b/test/Transforms/InstCombine/bitcast-vec-canon.ll @@ -0,0 +1,22 @@ +; RUN: opt < %s -instcombine -S | grep element | count 4 + +define double @a(<1 x i64> %y) { + %c = bitcast <1 x i64> %y to double + ret double %c +} + +define i64 @b(<1 x i64> %y) { + %c = bitcast <1 x i64> %y to i64 + ret i64 %c +} + +define <1 x i64> @c(double %y) { + %c = bitcast double %y to <1 x i64> + ret <1 x i64> %c +} + +define <1 x i64> @d(i64 %y) { + %c = bitcast i64 %y to <1 x i64> + ret <1 x i64> %c +} + diff --git a/test/Transforms/InstCombine/bitcast-vector-fold.ll b/test/Transforms/InstCombine/bitcast-vector-fold.ll index ded3e2f10abad..8feec229171af 100644 --- a/test/Transforms/InstCombine/bitcast-vector-fold.ll +++ b/test/Transforms/InstCombine/bitcast-vector-fold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast +; RUN: opt < %s -instcombine -S | not grep bitcast target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" diff --git a/test/Transforms/InstCombine/bitcount.ll b/test/Transforms/InstCombine/bitcount.ll index 8ebf289eb7d7b..f75ca2df69d1a 100644 --- a/test/Transforms/InstCombine/bitcount.ll +++ b/test/Transforms/InstCombine/bitcount.ll @@ -1,6 +1,6 @@ ; Tests to make sure bit counts of constants are folded -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 19} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | grep {ret i32 19} +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v declare | not grep llvm.ct declare i31 @llvm.ctpop.i31(i31 %val) diff --git a/test/Transforms/InstCombine/bittest.ll b/test/Transforms/InstCombine/bittest.ll index 8d45a48aa91d8..92863d59470aa 100644 --- a/test/Transforms/InstCombine/bittest.ll +++ b/test/Transforms/InstCombine/bittest.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -simplifycfg | llvm-dis |\ +; RUN: opt < %s -instcombine -simplifycfg -S |\ ; RUN: not grep {call void @abort} @b_rec.0 = external global i32 ; <i32*> [#uses=2] diff --git a/test/Transforms/InstCombine/bswap-fold.ll b/test/Transforms/InstCombine/bswap-fold.ll index 87d8b0496d266..3e56951c6077c 100644 --- a/test/Transforms/InstCombine/bswap-fold.ll +++ b/test/Transforms/InstCombine/bswap-fold.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | count 6 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call.*bswap +; RUN: opt < %s -instcombine -S | grep ret | count 6 +; RUN: opt < %s -instcombine -S | not grep call.*bswap define i1 @test1(i16 %tmp2) { %tmp10 = call i16 @llvm.bswap.i16( i16 %tmp2 ) ; <i16> [#uses=1] diff --git a/test/Transforms/InstCombine/bswap.ll b/test/Transforms/InstCombine/bswap.ll index 2ba718e58478c..c5aa8bede1784 100644 --- a/test/Transforms/InstCombine/bswap.ll +++ b/test/Transforms/InstCombine/bswap.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {call.*llvm.bswap} | count 6 define i32 @test1(i32 %i) { diff --git a/test/Transforms/InstCombine/call-cast-target.ll b/test/Transforms/InstCombine/call-cast-target.ll index 1a02514d1a7bc..7addc8abc84f2 100644 --- a/test/Transforms/InstCombine/call-cast-target.ll +++ b/test/Transforms/InstCombine/call-cast-target.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep call | not grep bitcast target datalayout = "e-p:32:32" diff --git a/test/Transforms/InstCombine/call-intrinsics.ll b/test/Transforms/InstCombine/call-intrinsics.ll index e1c60570f14f5..f9d108058063c 100644 --- a/test/Transforms/InstCombine/call-intrinsics.ll +++ b/test/Transforms/InstCombine/call-intrinsics.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis @X = global i8 0 ; <i8*> [#uses=3] @Y = global i8 12 ; <i8*> [#uses=2] diff --git a/test/Transforms/InstCombine/call.ll b/test/Transforms/InstCombine/call.ll index df9b2a68d9dc8..1e37eec7e94c5 100644 --- a/test/Transforms/InstCombine/call.ll +++ b/test/Transforms/InstCombine/call.ll @@ -1,7 +1,5 @@ ; Ignore stderr, we expect warnings there -; RUN: llvm-as < %s 2> /dev/null | opt -instcombine | llvm-dis | \ -; RUN: grep call | notcast -; END. +; RUN: opt < %s -instcombine 2> /dev/null -S | FileCheck %s ; Simple case, argument translatable without changing the value @@ -10,17 +8,24 @@ declare void @test1a(i8*) define void @test1(i32* %A) { call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A ) ret void +; CHECK: %tmp = bitcast i32* %A to i8* +; CHECK: call void @test1a(i8* %tmp) +; CHECK: ret void } ; More complex case, translate argument because of resolution. This is safe ; because we have the body of the function define void @test2a(i8 %A) { ret void +; CHECK: ret void } define i32 @test2(i32 %A) { call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A ) ret i32 %A +; CHECK: %tmp = trunc i32 %A to i8 +; CHECK: call void @test2a(i8 %tmp) +; CHECK: ret i32 %A } @@ -32,17 +37,24 @@ define void @test3(i8 %A, i8 %B) { call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B ) ret void +; CHECK: %tmp = zext i8 %B to i32 +; CHECK: call void (i8, ...)* @test3a(i8 %A, i32 %tmp) +; CHECK: ret void } ; test conversion of return value... define i8 @test4a() { ret i8 0 +; CHECK: ret i8 0 } define i32 @test4() { %X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1] ret i32 %X +; CHECK: %X1 = call i8 @test4a() +; CHECK: %tmp = zext i8 %X1 to i32 +; CHECK: ret i32 %tmp } @@ -53,6 +65,8 @@ declare i32 @test5a() define i32 @test5() { %X = call i32 @test5a( ) ; <i32> [#uses=1] ret i32 %X +; CHECK: %X = call i32 @test5a() +; CHECK: ret i32 %X } @@ -62,17 +76,22 @@ declare i32 @test6a(i32) define i32 @test6() { %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( ) ; <i32> [#uses=1] ret i32 %X +; CHECK: %X1 = call i32 @test6a(i32 0) +; CHECK: ret i32 %X1 } ; test removal of arguments, only can happen with a function body define void @test7a() { ret void +; CHECK: ret void } define void @test7() { call void bitcast (void ()* @test7a to void (i32)*)( i32 5 ) ret void +; CHECK: call void @test7a() +; CHECK: ret void } diff --git a/test/Transforms/InstCombine/call2.ll b/test/Transforms/InstCombine/call2.ll index 4ba840f7fb963..3a6bd67ce569e 100644 --- a/test/Transforms/InstCombine/call2.ll +++ b/test/Transforms/InstCombine/call2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis +; RUN: opt < %s -instcombine | llvm-dis ; This used to crash trying to do a double-to-pointer conversion define i32 @bar() { diff --git a/test/Transforms/InstCombine/canonicalize_branch.ll b/test/Transforms/InstCombine/canonicalize_branch.ll index 79f02e73209ab..52aff3dcd475c 100644 --- a/test/Transforms/InstCombine/canonicalize_branch.ll +++ b/test/Transforms/InstCombine/canonicalize_branch.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {icmp ne\|icmp ule\|icmp uge} define i32 @test1(i32 %X, i32 %Y) { diff --git a/test/Transforms/InstCombine/cast-and-cast.ll b/test/Transforms/InstCombine/cast-and-cast.ll index f90cb7499aff7..eda9d998be9cb 100644 --- a/test/Transforms/InstCombine/cast-and-cast.ll +++ b/test/Transforms/InstCombine/cast-and-cast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep bitcast define i1 @test1(i32 %val) { diff --git a/test/Transforms/InstCombine/cast-cast-to-and.ll b/test/Transforms/InstCombine/cast-cast-to-and.ll index bb7c3dd754cc4..1e591ccf493c1 100644 --- a/test/Transforms/InstCombine/cast-cast-to-and.ll +++ b/test/Transforms/InstCombine/cast-cast-to-and.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep i8 define i32 @test1(i32 %X) { diff --git a/test/Transforms/InstCombine/cast-load-gep.ll b/test/Transforms/InstCombine/cast-load-gep.ll index bc2c7b35163d8..57f021cc8de56 100644 --- a/test/Transforms/InstCombine/cast-load-gep.ll +++ b/test/Transforms/InstCombine/cast-load-gep.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -globaldce | llvm-dis | \ +; RUN: opt < %s -instcombine -globaldce -S | \ ; RUN: not grep Array ; Pulling the cast out of the load allows us to eliminate the load, and then diff --git a/test/Transforms/InstCombine/cast-malloc.ll b/test/Transforms/InstCombine/cast-malloc.ll index d05f6b04fd079..3754032cc2f79 100644 --- a/test/Transforms/InstCombine/cast-malloc.ll +++ b/test/Transforms/InstCombine/cast-malloc.ll @@ -1,5 +1,5 @@ ; test that casted mallocs get converted to malloc of the right type -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep bitcast ; The target datalayout is important for this test case. We have to tell diff --git a/test/Transforms/InstCombine/cast-mul-select.ll b/test/Transforms/InstCombine/cast-mul-select.ll index 76e9b24332f57..fcb7e2301d7f2 100644 --- a/test/Transforms/InstCombine/cast-mul-select.ll +++ b/test/Transforms/InstCombine/cast-mul-select.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @mul(i32 %x, i32 %y) { %A = trunc i32 %x to i8 @@ -6,6 +6,9 @@ define i32 @mul(i32 %x, i32 %y) { %C = mul i8 %A, %B %D = zext i8 %C to i32 ret i32 %D +; CHECK: %C = mul i32 %x, %y +; CHECK: %D = and i32 %C, 255 +; CHECK: ret i32 %D } define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) { @@ -16,6 +19,10 @@ define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) { %E = select i1 %cond, i8 %C, i8 %D %F = zext i8 %E to i32 ret i32 %F +; CHECK: %D = add i32 %x, %y +; CHECK: %E = select i1 %cond, i32 %z, i32 %D +; CHECK: %F = and i32 %E, 255 +; CHECK: ret i32 %F } define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) { @@ -26,4 +33,7 @@ define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) { %E = select i1 %cond, i32 %C, i32 %D %F = trunc i32 %E to i8 ret i8 %F +; CHECK: %D = add i8 %x, %y +; CHECK: %E = select i1 %cond, i8 %z, i8 %D +; CHECK: ret i8 %E } diff --git a/test/Transforms/InstCombine/cast-propagate.ll b/test/Transforms/InstCombine/cast-propagate.ll index c00f9537410a2..95c040b140d20 100644 --- a/test/Transforms/InstCombine/cast-propagate.ll +++ b/test/Transforms/InstCombine/cast-propagate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \ +; RUN: opt < %s -instcombine -mem2reg -S | \ ; RUN: not grep load define i32 @test1(i32* %P) { diff --git a/test/Transforms/InstCombine/cast-set.ll b/test/Transforms/InstCombine/cast-set.ll index 091f148a24833..611ded473efea 100644 --- a/test/Transforms/InstCombine/cast-set.ll +++ b/test/Transforms/InstCombine/cast-set.ll @@ -1,13 +1,15 @@ ; This tests for various complex cast elimination cases instcombine should ; handle. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i1 @test1(i32 %X) { %A = bitcast i32 %X to i32 ; <i32> [#uses=1] ; Convert to setne int %X, 12 %c = icmp ne i32 %A, 12 ; <i1> [#uses=1] ret i1 %c +; CHECK: %c = icmp ne i32 %X, 12 +; CHECK: ret i1 %c } define i1 @test2(i32 %X, i32 %Y) { @@ -16,6 +18,8 @@ define i1 @test2(i32 %X, i32 %Y) { ; Convert to setne int %X, %Y %c = icmp ne i32 %A, %B ; <i1> [#uses=1] ret i1 %c +; CHECK: %c = icmp ne i32 %X, %Y +; CHECK: ret i1 %c } define i32 @test4(i32 %A) { @@ -23,6 +27,8 @@ define i32 @test4(i32 %A) { %C = shl i32 %B, 2 ; <i32> [#uses=1] %D = bitcast i32 %C to i32 ; <i32> [#uses=1] ret i32 %D +; CHECK: %C = shl i32 %A, 2 +; CHECK: ret i32 %C } define i16 @test5(i16 %A) { @@ -30,22 +36,28 @@ define i16 @test5(i16 %A) { %C = and i32 %B, 15 ; <i32> [#uses=1] %D = trunc i32 %C to i16 ; <i16> [#uses=1] ret i16 %D +; CHECK: %C = and i16 %A, 15 +; CHECK: ret i16 %C } define i1 @test6(i1 %A) { %B = zext i1 %A to i32 ; <i32> [#uses=1] %C = icmp ne i32 %B, 0 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 %A } define i1 @test6a(i1 %A) { %B = zext i1 %A to i32 ; <i32> [#uses=1] %C = icmp ne i32 %B, -1 ; <i1> [#uses=1] ret i1 %C +; CHECK: ret i1 true } define i1 @test7(i8* %A) { %B = bitcast i8* %A to i32* ; <i32*> [#uses=1] %C = icmp eq i32* %B, null ; <i1> [#uses=1] ret i1 %C +; CHECK: %C = icmp eq i8* %A, null +; CHECK: ret i1 %C } diff --git a/test/Transforms/InstCombine/cast-sext-zext.ll b/test/Transforms/InstCombine/cast-sext-zext.ll index 1acd7582100f8..0fecc1ce127d5 100644 --- a/test/Transforms/InstCombine/cast-sext-zext.ll +++ b/test/Transforms/InstCombine/cast-sext-zext.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext +; RUN: opt < %s -instcombine -S | not grep sext ; XFAIL: * define zeroext i16 @t(i8 zeroext %on_off, i16* nocapture %puls) nounwind readonly { diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 7a1e7a802dd36..9835d657c9bb6 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -1,5 +1,5 @@ ; Tests to make sure elimination of casts is working correctly -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep %c | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s @inbuf = external global [32832 x i8] ; <[32832 x i8]*> [#uses=1] @@ -7,6 +7,7 @@ define i32 @test1(i32 %A) { %c1 = bitcast i32 %A to i32 ; <i32> [#uses=1] %c2 = bitcast i32 %c1 to i32 ; <i32> [#uses=1] ret i32 %c2 +; CHECK: ret i32 %A } define i64 @test2(i8 %A) { @@ -14,6 +15,8 @@ define i64 @test2(i8 %A) { %c2 = zext i16 %c1 to i32 ; <i32> [#uses=1] %Ret = zext i32 %c2 to i64 ; <i64> [#uses=1] ret i64 %Ret +; CHECK: %Ret = zext i8 %A to i64 +; CHECK: ret i64 %Ret } ; This function should just use bitwise AND @@ -21,6 +24,8 @@ define i64 @test3(i64 %A) { %c1 = trunc i64 %A to i8 ; <i8> [#uses=1] %c2 = zext i8 %c1 to i64 ; <i64> [#uses=1] ret i64 %c2 +; CHECK: %c2 = and i64 %A, 255 +; CHECK: ret i64 %c2 } define i32 @test4(i32 %A, i32 %B) { @@ -30,6 +35,9 @@ define i32 @test4(i32 %A, i32 %B) { ; for the cast elim purpose %result = zext i8 %c to i32 ; <i32> [#uses=1] ret i32 %result +; CHECK: %COND = icmp slt i32 %A, %B +; CHECK: %result = zext i1 %COND to i32 +; CHECK: ret i32 %result } define i32 @test5(i1 %B) { @@ -38,36 +46,46 @@ define i32 @test5(i1 %B) { ; this cast %result = zext i8 %c to i32 ; <i32> [#uses=1] ret i32 %result +; CHECK: %result = zext i1 %B to i32 +; CHECK: ret i32 %result } define i32 @test6(i64 %A) { %c1 = trunc i64 %A to i32 ; <i32> [#uses=1] %res = bitcast i32 %c1 to i32 ; <i32> [#uses=1] ret i32 %res +; CHECK: %res = trunc i64 %A to i32 +; CHECK: ret i32 %res } define i64 @test7(i1 %A) { %c1 = zext i1 %A to i32 ; <i32> [#uses=1] %res = sext i32 %c1 to i64 ; <i64> [#uses=1] ret i64 %res +; CHECK: %res = zext i1 %A to i64 +; CHECK: ret i64 %res } define i64 @test8(i8 %A) { %c1 = sext i8 %A to i64 ; <i64> [#uses=1] %res = bitcast i64 %c1 to i64 ; <i64> [#uses=1] ret i64 %res +; CHECK: %res = sext i8 %A to i64 +; CHECK: ret i64 %res } define i16 @test9(i16 %A) { %c1 = sext i16 %A to i32 ; <i32> [#uses=1] %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1] ret i16 %c2 +; CHECK: ret i16 %A } define i16 @test10(i16 %A) { %c1 = sext i16 %A to i32 ; <i32> [#uses=1] %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1] ret i16 %c2 +; CHECK: ret i16 %A } declare void @varargs(i32, ...) @@ -76,22 +94,31 @@ define void @test11(i32* %P) { %c = bitcast i32* %P to i16* ; <i16*> [#uses=1] call void (i32, ...)* @varargs( i32 5, i16* %c ) ret void +; CHECK: call void (i32, ...)* @varargs(i32 5, i32* %P) +; CHECK: ret void } define i32* @test12() { %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1] ret i32* %c +; CHECK: %p = malloc i32 +; CHECK: ret i32* %p } + define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1] ret i8* %c +; CHECK: %c = getelementptr [32832 x i8]* @inbuf, i64 0, i64 %A +; CHECK: ret i8* %c } define i1 @test14(i8 %A) { %c = bitcast i8 %A to i8 ; <i8> [#uses=1] %X = icmp ult i8 %c, -128 ; <i1> [#uses=1] ret i1 %X +; CHECK: %X = icmp sgt i8 %A, -1 +; CHECK: ret i1 %X } @@ -105,24 +132,32 @@ define i1 @test14(i8 %A) { define i1 @test16(i32* %P) { %c = icmp ne i32* %P, null ; <i1> [#uses=1] ret i1 %c +; CHECK: %c = icmp ne i32* %P, null +; CHECK: ret i1 %c } define i16 @test17(i1 %tmp3) { %c = zext i1 %tmp3 to i32 ; <i32> [#uses=1] %t86 = trunc i32 %c to i16 ; <i16> [#uses=1] ret i16 %t86 +; CHECK: %t86 = zext i1 %tmp3 to i16 +; CHECK: ret i16 %t86 } define i16 @test18(i8 %tmp3) { %c = sext i8 %tmp3 to i32 ; <i32> [#uses=1] %t86 = trunc i32 %c to i16 ; <i16> [#uses=1] ret i16 %t86 +; CHECK: %t86 = sext i8 %tmp3 to i16 +; CHECK: ret i16 %t86 } define i1 @test19(i32 %X) { %c = sext i32 %X to i64 ; <i64> [#uses=1] %Z = icmp slt i64 %c, 12345 ; <i1> [#uses=1] ret i1 %Z +; CHECK: %Z = icmp slt i32 %X, 12345 +; CHECK: ret i1 %Z } define i1 @test20(i1 %B) { @@ -130,6 +165,7 @@ define i1 @test20(i1 %B) { %D = icmp slt i32 %c, -1 ; <i1> [#uses=1] ;; false ret i1 %D +; CHECK: ret i1 false } define i32 @test21(i32 %X) { @@ -138,6 +174,8 @@ define i32 @test21(i32 %X) { %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1] %RV = and i32 %c2, 255 ; <i32> [#uses=1] ret i32 %RV +; CHECK: %c21 = and i32 %X, 255 +; CHECK: ret i32 %c21 } define i32 @test22(i32 %X) { @@ -146,6 +184,8 @@ define i32 @test22(i32 %X) { %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1] %RV = shl i32 %c2, 24 ; <i32> [#uses=1] ret i32 %RV +; CHECK: %RV = shl i32 %X, 24 +; CHECK: ret i32 %RV } define i32 @test23(i32 %X) { @@ -154,6 +194,8 @@ define i32 @test23(i32 %X) { ;; and Z are signed. %c2 = zext i16 %c1 to i32 ; <i32> [#uses=1] ret i32 %c2 +; CHECK: %c2 = and i32 %X, 65535 +; CHECK: ret i32 %c2 } define i1 @test24(i1 %C) { @@ -161,6 +203,7 @@ define i1 @test24(i1 %C) { ;; Fold cast into select %c = icmp ne i32 %X, 0 ; <i1> [#uses=1] ret i1 %c +; CHECK: ret i1 true } define void @test25(i32** %P) { @@ -168,6 +211,8 @@ define void @test25(i32** %P) { ;; Fold cast into null store float* null, float** %c ret void +; CHECK: store i32* null, i32** %P +; CHECK: ret void } define i32 @test26(float %F) { @@ -175,16 +220,22 @@ define i32 @test26(float %F) { %c = fpext float %F to double ; <double> [#uses=1] %D = fptosi double %c to i32 ; <i32> [#uses=1] ret i32 %D +; CHECK: %D = fptosi float %F to i32 +; CHECK: ret i32 %D } define [4 x float]* @test27([9 x [4 x float]]* %A) { %c = bitcast [9 x [4 x float]]* %A to [4 x float]* ; <[4 x float]*> [#uses=1] ret [4 x float]* %c +; CHECK: %c = getelementptr inbounds [9 x [4 x float]]* %A, i64 0, i64 0 +; CHECK: ret [4 x float]* %c } define float* @test28([4 x float]* %A) { %c = bitcast [4 x float]* %A to float* ; <float*> [#uses=1] ret float* %c +; CHECK: %c = getelementptr inbounds [4 x float]* %A, i64 0, i64 0 +; CHECK: ret float* %c } define i32 @test29(i32 %c1, i32 %c2) { @@ -193,6 +244,9 @@ define i32 @test29(i32 %c1, i32 %c2) { %tmp = or i8 %tmp4.mask, %tmp1 ; <i8> [#uses=1] %tmp10 = zext i8 %tmp to i32 ; <i32> [#uses=1] ret i32 %tmp10 +; CHECK: %tmp2 = or i32 %c2, %c1 +; CHECK: %tmp10 = and i32 %tmp2, 255 +; CHECK: ret i32 %tmp10 } define i32 @test30(i32 %c1) { @@ -200,6 +254,9 @@ define i32 @test30(i32 %c1) { %c3 = xor i8 %c2, 1 ; <i8> [#uses=1] %c4 = zext i8 %c3 to i32 ; <i32> [#uses=1] ret i32 %c4 +; CHECK: %c3 = and i32 %c1, 255 +; CHECK: %c4 = xor i32 %c3, 1 +; CHECK: ret i32 %c4 } define i1 @test31(i64 %A) { @@ -207,6 +264,9 @@ define i1 @test31(i64 %A) { %C = and i32 %B, 42 ; <i32> [#uses=1] %D = icmp eq i32 %C, 10 ; <i1> [#uses=1] ret i1 %D +; CHECK: %C1 = and i64 %A, 42 +; CHECK: %D = icmp eq i64 %C1, 10 +; CHECK: ret i1 %D } define void @test32(double** %tmp) { @@ -214,12 +274,17 @@ define void @test32(double** %tmp) { %tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1] store double* %tmp8.upgrd.1, double** %tmp ret void +; CHECK: %tmp81 = malloc [2 x double] +; CHECK: %tmp81.sub = getelementptr inbounds [2 x double]* %tmp81, i64 0, i64 0 +; CHECK: store double* %tmp81.sub, double** %tmp +; CHECK: ret void } define i32 @test33(i32 %c1) { %x = bitcast i32 %c1 to float ; <float> [#uses=1] %y = bitcast float %x to i32 ; <i32> [#uses=1] ret i32 %y +; CHECK: ret i32 %c1 } define i16 @test34(i16 %a) { @@ -227,6 +292,8 @@ define i16 @test34(i16 %a) { %tmp21 = lshr i32 %c1, 8 ; <i32> [#uses=1] %c2 = trunc i32 %tmp21 to i16 ; <i16> [#uses=1] ret i16 %c2 +; CHECK: %tmp21 = lshr i16 %a, 8 +; CHECK: ret i16 %tmp21 } define i16 @test35(i16 %a) { @@ -234,6 +301,8 @@ define i16 @test35(i16 %a) { %tmp2 = lshr i16 %c1, 8 ; <i16> [#uses=1] %c2 = bitcast i16 %tmp2 to i16 ; <i16> [#uses=1] ret i16 %c2 +; CHECK: %tmp2 = lshr i16 %a, 8 +; CHECK: ret i16 %tmp2 } ; icmp sgt i32 %a, -1 @@ -243,6 +312,8 @@ define i1 @test36(i32 %a) { %c = trunc i32 %b to i8 %d = icmp eq i8 %c, 0 ret i1 %d +; CHECK: %d = icmp sgt i32 %a, -1 +; CHECK: ret i1 %d } ; ret i1 false @@ -252,6 +323,7 @@ define i1 @test37(i32 %a) { %d = trunc i32 %c to i8 %e = icmp eq i8 %d, 11 ret i1 %e +; CHECK: ret i1 false } define i64 @test38(i32 %a) { @@ -260,4 +332,7 @@ define i64 @test38(i32 %a) { %3 = xor i8 %2, 1 %4 = zext i8 %3 to i64 ret i64 %4 +; CHECK: %1 = icmp ne i32 %a, -2 +; CHECK: %2 = zext i1 %1 to i64 +; CHECK: ret i64 %2 } diff --git a/test/Transforms/InstCombine/cast2.ll b/test/Transforms/InstCombine/cast2.ll index 5cc9087198b27..0ae869fa49384 100644 --- a/test/Transforms/InstCombine/cast2.ll +++ b/test/Transforms/InstCombine/cast2.ll @@ -1,5 +1,5 @@ ; Tests to make sure elimination of casts is working correctly -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s define i16 @test1(i16 %a) { %tmp = zext i16 %a to i32 ; <i32> [#uses=2] @@ -8,6 +8,8 @@ define i16 @test1(i16 %a) { %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1] %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1] ret i16 %tmp.upgrd.3 +; CHECK: %tmp.upgrd.32 = call i16 @llvm.bswap.i16(i16 %a) +; CHECK: ret i16 %tmp.upgrd.32 } define i16 @test2(i16 %a) { @@ -17,6 +19,10 @@ define i16 @test2(i16 %a) { %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1] %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1] ret i16 %tmp.upgrd.3 +; CHECK: %tmp21 = lshr i16 %a, 9 +; CHECK: %tmp5 = shl i16 %a, 8 +; CHECK: %tmp.upgrd.32 = or i16 %tmp21, %tmp5 +; CHECK: ret i16 %tmp.upgrd.32 } ; PR1263 @@ -24,6 +30,7 @@ define i32* @test3(i32* %tmp1) { %tmp64 = bitcast i32* %tmp1 to { i32 }* ; <{ i32 }*> [#uses=1] %tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0 ; <i32*> [#uses=1] ret i32* %tmp65 +; CHECK: ret i32* %tmp1 } diff --git a/test/Transforms/InstCombine/cast3.ll b/test/Transforms/InstCombine/cast3.ll new file mode 100644 index 0000000000000..bc60f55c48c86 --- /dev/null +++ b/test/Transforms/InstCombine/cast3.ll @@ -0,0 +1,35 @@ +; RUN: opt < %s -instcombine -S | not grep getelementptr +; PR2831 + +; Don't raise arbitrary inttoptr+arithmetic+ptrtoint to getelementptr. + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" + +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: + %0 = ptrtoint i8** %argv to i32 ; <i32> [#uses=1] + %1 = add i32 %0, 1 ; <i32> [#uses=1] + ret i32 %1 +} + +; This testcase could theoretically be optimized down to return zero, +; but for now being conservative with ptrtoint/inttoptr is fine. +define i32 @a() nounwind { +entry: + %b = alloca i32 ; <i32*> [#uses=3] + %a = alloca i32 ; <i32*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store i32 1, i32* %b, align 4 + %a1 = ptrtoint i32* %a to i32 ; <i32> [#uses=1] + %b4 = ptrtoint i32* %b to i32 ; <i32> [#uses=1] + %a7 = ptrtoint i32* %a to i32 ; <i32> [#uses=1] + %0 = sub i32 %b4, %a7 ; <i32> [#uses=1] + %1 = add i32 %a1, %0 ; <i32> [#uses=1] + %2 = inttoptr i32 %1 to i32* ; <i32*> [#uses=1] + store i32 0, i32* %2, align 4 + %3 = load i32* %b, align 4 ; <i32> [#uses=1] + br label %return + +return: ; preds = %entry + ret i32 %3 +} diff --git a/test/Transforms/InstCombine/cast_ld_addr_space.ll b/test/Transforms/InstCombine/cast_ld_addr_space.ll index beb20e38545a2..e94dce7e906ba 100644 --- a/test/Transforms/InstCombine/cast_ld_addr_space.ll +++ b/test/Transforms/InstCombine/cast_ld_addr_space.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep bitcast | count 1 +; RUN: opt < %s -instcombine -S | grep bitcast | count 1 ; InstCombine can not 'load (cast P)' -> cast (load P)' if the cast changes ; the address space. diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll index fd600a8830477..6544e7d735a44 100644 --- a/test/Transforms/InstCombine/cast_ptr.ll +++ b/test/Transforms/InstCombine/cast_ptr.ll @@ -1,8 +1,15 @@ ; Tests to make sure elimination of casts is working correctly -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast +; RUN: opt < %s -instcombine -S | FileCheck %s target datalayout = "p:32:32" +; This shouldn't convert to getelementptr because the relationship +; between the arithmetic and the layout of allocated memory is +; entirely unknown. +; CHECK: @test1 +; CHECK: ptrtoint +; CHECK: add +; CHECK: inttoptr define i8* @test1(i8* %t) { %tmpc = ptrtoint i8* %t to i32 ; <i32> [#uses=1] %tmpa = add i32 %tmpc, 32 ; <i32> [#uses=1] @@ -10,6 +17,9 @@ define i8* @test1(i8* %t) { ret i8* %tv } +; These casts should be folded away. +; CHECK: @test2 +; CHECK: icmp eq i8* %a, %b define i1 @test2(i8* %a, i8* %b) { %tmpa = ptrtoint i8* %a to i32 ; <i32> [#uses=1] %tmpb = ptrtoint i8* %b to i32 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/constant-fold-gep.ll b/test/Transforms/InstCombine/constant-fold-gep.ll new file mode 100644 index 0000000000000..5a7aef3d397a0 --- /dev/null +++ b/test/Transforms/InstCombine/constant-fold-gep.ll @@ -0,0 +1,54 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; Constant folding should fix notionally out-of-bounds indices +; and add inbounds keywords. + +%struct.X = type { [3 x i32], [3 x i32] } + +@Y = internal global [3 x %struct.X] zeroinitializer + +define void @frob() { +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 0), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 1), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 2), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 0), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 3), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 4), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 0, i32 1, i64 2), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 5), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 6), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 7), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 8), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 0), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 9), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 10), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 1, i32 1, i64 2), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 11), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 12), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 1), align 4 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 13), align 4 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 0, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 14), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 15), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 1), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 16), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 0, i64 2, i32 1, i64 2), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 17), align 8 +; CHECK: store i32 1, i32* getelementptr inbounds ([3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 18), align 8 +; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 2, i64 0, i32 0, i64 0), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 36), align 8 +; CHECK: store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 1, i64 0, i32 0, i64 1), align 8 + store i32 1, i32* getelementptr ([3 x %struct.X]* @Y, i64 0, i64 0, i32 0, i64 19), align 8 + ret void +} diff --git a/test/Transforms/InstCombine/constant-fold-ptr-casts.ll b/test/Transforms/InstCombine/constant-fold-ptr-casts.ll index 27c4606891849..9b6c6c3f58f29 100644 --- a/test/Transforms/InstCombine/constant-fold-ptr-casts.ll +++ b/test/Transforms/InstCombine/constant-fold-ptr-casts.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 2143034560} +; RUN: opt < %s -instcombine -S | grep {ret i32 2143034560} ; Instcombine should be able to completely fold this code. diff --git a/test/Transforms/InstCombine/crash.ll b/test/Transforms/InstCombine/crash.ll new file mode 100644 index 0000000000000..d475ab5bc57cf --- /dev/null +++ b/test/Transforms/InstCombine/crash.ll @@ -0,0 +1,46 @@ +; RUN: opt < %s -instcombine | llvm-dis +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin10.0" + +define i32 @test0(i8 %tmp2) ssp { +entry: + %tmp3 = zext i8 %tmp2 to i32 + %tmp8 = lshr i32 %tmp3, 6 + %tmp9 = lshr i32 %tmp3, 7 + %tmp10 = xor i32 %tmp9, 67108858 + %tmp11 = xor i32 %tmp10, %tmp8 + %tmp12 = xor i32 %tmp11, 0 + ret i32 %tmp12 +} + +; PR4905 +define <2 x i64> @test1(<2 x i64> %x, <2 x i64> %y) nounwind { +entry: + %conv.i94 = bitcast <2 x i64> %y to <4 x i32> ; <<4 x i32>> [#uses=1] + %sub.i97 = sub <4 x i32> %conv.i94, undef ; <<4 x i32>> [#uses=1] + %conv3.i98 = bitcast <4 x i32> %sub.i97 to <2 x i64> ; <<2 x i64>> [#uses=2] + %conv2.i86 = bitcast <2 x i64> %conv3.i98 to <4 x i32> ; <<4 x i32>> [#uses=1] + %cmp.i87 = icmp sgt <4 x i32> undef, %conv2.i86 ; <<4 x i1>> [#uses=1] + %sext.i88 = sext <4 x i1> %cmp.i87 to <4 x i32> ; <<4 x i32>> [#uses=1] + %conv3.i89 = bitcast <4 x i32> %sext.i88 to <2 x i64> ; <<2 x i64>> [#uses=1] + %and.i = and <2 x i64> %conv3.i89, %conv3.i98 ; <<2 x i64>> [#uses=1] + %or.i = or <2 x i64> zeroinitializer, %and.i ; <<2 x i64>> [#uses=1] + %conv2.i43 = bitcast <2 x i64> %or.i to <4 x i32> ; <<4 x i32>> [#uses=1] + %sub.i = sub <4 x i32> zeroinitializer, %conv2.i43 ; <<4 x i32>> [#uses=1] + %conv3.i44 = bitcast <4 x i32> %sub.i to <2 x i64> ; <<2 x i64>> [#uses=1] + ret <2 x i64> %conv3.i44 +} + + +; PR4908 +define void @test2(<1 x i16>* nocapture %b, i32* nocapture %c) nounwind ssp { +entry: + %arrayidx = getelementptr inbounds <1 x i16>* %b, i64 undef ; <<1 x i16>*> + %tmp2 = load <1 x i16>* %arrayidx ; <<1 x i16>> [#uses=1] + %tmp6 = bitcast <1 x i16> %tmp2 to i16 ; <i16> [#uses=1] + %tmp7 = zext i16 %tmp6 to i32 ; <i32> [#uses=1] + %ins = or i32 0, %tmp7 ; <i32> [#uses=1] + %arrayidx20 = getelementptr inbounds i32* %c, i64 undef ; <i32*> [#uses=1] + store i32 %ins, i32* %arrayidx20 + ret void +} diff --git a/test/Transforms/InstCombine/dce-iterate.ll b/test/Transforms/InstCombine/dce-iterate.ll index faefa8add9ec3..1d2cc53210fea 100644 --- a/test/Transforms/InstCombine/dce-iterate.ll +++ b/test/Transforms/InstCombine/dce-iterate.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret double .sy} +; RUN: opt < %s -instcombine -S | grep {ret double .sy} define internal double @ScaleObjectAdd(double %sx, double %sy, double %sz) nounwind { entry: diff --git a/test/Transforms/InstCombine/deadcode.ll b/test/Transforms/InstCombine/deadcode.ll index 43c1793155488..52af0ef4e8d4e 100644 --- a/test/Transforms/InstCombine/deadcode.ll +++ b/test/Transforms/InstCombine/deadcode.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 %A} -; RUN: llvm-as < %s | opt -die | llvm-dis | not grep call.*llvm.stacksave +; RUN: opt < %s -instcombine -S | grep {ret i32 %A} +; RUN: opt < %s -die -S | not grep call.*llvm.stacksave define i32 @test(i32 %A) { %X = or i1 false, false diff --git a/test/Transforms/InstCombine/div-cmp-overflow.ll b/test/Transforms/InstCombine/div-cmp-overflow.ll index 9276c96479d7e..6f63adcd2e171 100644 --- a/test/Transforms/InstCombine/div-cmp-overflow.ll +++ b/test/Transforms/InstCombine/div-cmp-overflow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sdiv +; RUN: opt < %s -instcombine -S | not grep sdiv ; PR2740 define i1 @func_75(i32 %i2) nounwind { diff --git a/test/Transforms/InstCombine/div.ll b/test/Transforms/InstCombine/div.ll index ea6ea6323c564..0d1398082601e 100644 --- a/test/Transforms/InstCombine/div.ll +++ b/test/Transforms/InstCombine/div.ll @@ -1,6 +1,6 @@ ; This test makes sure that div instructions are properly eliminated. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div +; RUN: opt < %s -instcombine -S | not grep div define i32 @test1(i32 %A) { %B = sdiv i32 %A, 1 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/enforce-known-alignment.ll b/test/Transforms/InstCombine/enforce-known-alignment.ll index 6ac24a85a22e9..9e9be7f56575d 100644 --- a/test/Transforms/InstCombine/enforce-known-alignment.ll +++ b/test/Transforms/InstCombine/enforce-known-alignment.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep alloca | grep {align 16} +; RUN: opt < %s -instcombine -S | grep alloca | grep {align 16} target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" diff --git a/test/Transforms/InstCombine/exact-sdiv.ll b/test/Transforms/InstCombine/exact-sdiv.ll new file mode 100644 index 0000000000000..e5677541e9524 --- /dev/null +++ b/test/Transforms/InstCombine/exact-sdiv.ll @@ -0,0 +1,52 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; CHECK: define i32 @foo +; CHECK: sdiv i32 %x, 8 +define i32 @foo(i32 %x) { + %y = sdiv i32 %x, 8 + ret i32 %y +} + +; CHECK: define i32 @bar +; CHECK: ashr i32 %x, 3 +define i32 @bar(i32 %x) { + %y = sdiv exact i32 %x, 8 + ret i32 %y +} + +; CHECK: i32 @a0 +; CHECK: %y = srem i32 %x, 3 +; CHECK: %z = sub i32 %x, %y +; CHECK: ret i32 %z +define i32 @a0(i32 %x) { + %y = sdiv i32 %x, 3 + %z = mul i32 %y, 3 + ret i32 %z +} + +; CHECK: i32 @b0 +; CHECK: ret i32 %x +define i32 @b0(i32 %x) { + %y = sdiv exact i32 %x, 3 + %z = mul i32 %y, 3 + ret i32 %z +} + +; CHECK: i32 @a1 +; CHECK: %y = srem i32 %x, 3 +; CHECK: %z = sub i32 %y, %x +; CHECK: ret i32 %z +define i32 @a1(i32 %x) { + %y = sdiv i32 %x, 3 + %z = mul i32 %y, -3 + ret i32 %z +} + +; CHECK: i32 @b1 +; CHECK: %z = sub i32 0, %x +; CHECK: ret i32 %z +define i32 @b1(i32 %x) { + %y = sdiv exact i32 %x, 3 + %z = mul i32 %y, -3 + ret i32 %z +} diff --git a/test/Transforms/InstCombine/extractvalue.ll b/test/Transforms/InstCombine/extractvalue.ll index 59b996e130e1c..875f860b3d7fa 100644 --- a/test/Transforms/InstCombine/extractvalue.ll +++ b/test/Transforms/InstCombine/extractvalue.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractvalue +; RUN: opt < %s -instcombine -S | not grep extractvalue ; Instcombine should fold various combinations of insertvalue and extractvalue ; together diff --git a/test/Transforms/InstCombine/fold-bin-operand.ll b/test/Transforms/InstCombine/fold-bin-operand.ll new file mode 100644 index 0000000000000..b837985a263be --- /dev/null +++ b/test/Transforms/InstCombine/fold-bin-operand.ll @@ -0,0 +1,13 @@ +; RUN: opt < %s -instcombine -S | not grep icmp + +define i1 @f(i1 %x) { + %b = and i1 %x, icmp eq (i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 2 to i8*)) + ret i1 %b +} + +; FIXME: This doesn't fold at the moment! +; define i32 @f(i32 %x) { +; %b = add i32 %x, zext (i1 icmp eq (i8* inttoptr (i32 1000000 to i8*), i8* inttoptr (i32 2000000 to i8*)) to i32) +; ret i32 %b +;} + diff --git a/test/Transforms/InstCombine/fold-vector-zero.ll b/test/Transforms/InstCombine/fold-vector-zero.ll index 0b5b30a5c6e7c..e1d86b6cd07cb 100644 --- a/test/Transforms/InstCombine/fold-vector-zero.ll +++ b/test/Transforms/InstCombine/fold-vector-zero.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep zeroinitializer +; RUN: opt < %s -instcombine -S | not grep zeroinitializer define void @foo(i64 %A, i64 %B) { bb8: diff --git a/test/Transforms/InstCombine/fp-ret-bitcast.ll b/test/Transforms/InstCombine/fp-ret-bitcast.ll index 00c1ea0b96a63..169340abf360a 100644 --- a/test/Transforms/InstCombine/fp-ret-bitcast.ll +++ b/test/Transforms/InstCombine/fp-ret-bitcast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {call float bitcast} | count 1 %struct.NSObject = type { %struct.objc_class* } %struct.NSArray = type { %struct.NSObject } diff --git a/test/Transforms/InstCombine/fpcast.ll b/test/Transforms/InstCombine/fpcast.ll index 7f25092976f9c..bc6aa0a6891f6 100644 --- a/test/Transforms/InstCombine/fpcast.ll +++ b/test/Transforms/InstCombine/fpcast.ll @@ -1,15 +1,15 @@ ; Test some floating point casting cases -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | notcast -; RUN: llvm-as %s -o - | opt -instcombine | llvm-dis | \ -; RUN: egrep {ret i8 \(-1\)\|\(255\)} +; RUN: opt < %s -instcombine -S | FileCheck %s define i8 @test1() { %x = fptoui float 2.550000e+02 to i8 ; <i8> [#uses=1] ret i8 %x +; CHECK: ret i8 -1 } define i8 @test2() { %x = fptosi float -1.000000e+00 to i8 ; <i8> [#uses=1] ret i8 %x +; CHECK: ret i8 -1 } diff --git a/test/Transforms/InstCombine/fpextend.ll b/test/Transforms/InstCombine/fpextend.ll index c212128eb99ad..70e0c62dd70e1 100644 --- a/test/Transforms/InstCombine/fpextend.ll +++ b/test/Transforms/InstCombine/fpextend.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep fpext +; RUN: opt < %s -instcombine -S | not grep fpext @X = external global float @Y = external global float diff --git a/test/Transforms/InstCombine/fsub-fsub.ll b/test/Transforms/InstCombine/fsub-fsub.ll index ab70479204b17..94ebf090ff33b 100644 --- a/test/Transforms/InstCombine/fsub-fsub.ll +++ b/test/Transforms/InstCombine/fsub-fsub.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fsub | count 2 +; RUN: opt < %s -instcombine -S | grep fsub | count 2 ; PR4374 define float @func(float %a, float %b) nounwind { diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index c2cb720803194..ffaa6afa85e35 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -1,81 +1,470 @@ -; The %A getelementptr instruction should be eliminated here +; RUN: opt < %s -instcombine -S | FileCheck %s -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep -v %B | not grep getelementptr -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep foo1 -; END. +target datalayout = "e-p:64:64" +%intstruct = type { i32 } +%pair = type { i32, i32 } +%struct.B = type { double } +%struct.A = type { %struct.B, i32, i32 } -@Global = constant [10 x i8] c"helloworld" ; <[10 x i8]*> [#uses=1] + +@Global = constant [10 x i8] c"helloworld" ; Test noop elimination -define i32* @foo1(i32* %I) { - %A = getelementptr i32* %I, i64 0 ; <i32*> [#uses=1] +define i32* @test1(i32* %I) { + %A = getelementptr i32* %I, i64 0 ret i32* %A +; CHECK: @test1 +; CHECK: ret i32* %I } ; Test noop elimination -define i32* @foo2(i32* %I) { - %A = getelementptr i32* %I ; <i32*> [#uses=1] +define i32* @test2(i32* %I) { + %A = getelementptr i32* %I ret i32* %A +; CHECK: @test2 +; CHECK: ret i32* %I } ; Test that two array indexing geps fold -define i32* @foo3(i32* %I) { - %A = getelementptr i32* %I, i64 17 ; <i32*> [#uses=1] - %B = getelementptr i32* %A, i64 4 ; <i32*> [#uses=1] +define i32* @test3(i32* %I) { + %A = getelementptr i32* %I, i64 17 + %B = getelementptr i32* %A, i64 4 ret i32* %B +; CHECK: @test3 +; CHECK: getelementptr i32* %I, i64 21 } ; Test that two getelementptr insts fold -define i32* @foo4({ i32 }* %I) { - %A = getelementptr { i32 }* %I, i64 1 ; <{ i32 }*> [#uses=1] - %B = getelementptr { i32 }* %A, i64 0, i32 0 ; <i32*> [#uses=1] +define i32* @test4({ i32 }* %I) { + %A = getelementptr { i32 }* %I, i64 1 + %B = getelementptr { i32 }* %A, i64 0, i32 0 ret i32* %B +; CHECK: @test4 +; CHECK: getelementptr %intstruct* %I, i64 1, i32 0 } -define void @foo5(i8 %B) { +define void @test5(i8 %B) { ; This should be turned into a constexpr instead of being an instruction - %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 ; <i8*> [#uses=1] + %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 store i8 %B, i8* %A ret void +; CHECK: @test5 +; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4) } -define i32* @foo6() { - %M = malloc [4 x i32] ; <[4 x i32]*> [#uses=1] - %A = getelementptr [4 x i32]* %M, i64 0, i64 0 ; <i32*> [#uses=1] - %B = getelementptr i32* %A, i64 2 ; <i32*> [#uses=1] +define i32* @test6() { + %M = malloc [4 x i32] + %A = getelementptr [4 x i32]* %M, i64 0, i64 0 + %B = getelementptr i32* %A, i64 2 ret i32* %B +; CHECK: @test6 +; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 } -define i32* @foo7(i32* %I, i64 %C, i64 %D) { - %A = getelementptr i32* %I, i64 %C ; <i32*> [#uses=1] - %B = getelementptr i32* %A, i64 %D ; <i32*> [#uses=1] +define i32* @test7(i32* %I, i64 %C, i64 %D) { + %A = getelementptr i32* %I, i64 %C + %B = getelementptr i32* %A, i64 %D ret i32* %B +; CHECK: @test7 +; CHECK: %A.sum = add i64 %C, %D +; CHECK: getelementptr i32* %I, i64 %A.sum } -define i8* @foo8([10 x i32]* %X) { +define i8* @test8([10 x i32]* %X) { ;; Fold into the cast. - %A = getelementptr [10 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=1] - %B = bitcast i32* %A to i8* ; <i8*> [#uses=1] + %A = getelementptr [10 x i32]* %X, i64 0, i64 0 + %B = bitcast i32* %A to i8* ret i8* %B +; CHECK: @test8 +; CHECK: bitcast [10 x i32]* %X to i8* } define i32 @test9() { - %A = getelementptr { i32, double }* null, i32 0, i32 1 ; <double*> [#uses=1] - %B = ptrtoint double* %A to i32 ; <i32> [#uses=1] + %A = getelementptr { i32, double }* null, i32 0, i32 1 + %B = ptrtoint double* %A to i32 ret i32 %B +; CHECK: @test9 +; CHECK: ret i32 8 } define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { - %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=1] - %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ; <i32*> [#uses=1] + %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 + %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ;; seteq x, y - %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ; <i1> [#uses=1] + %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ret i1 %tmp.4 +; CHECK: @test10 +; CHECK: icmp eq %pair* %x, %y } define i1 @test11({ i32, i32 }* %X) { - %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 ; <i32*> [#uses=1] - %Q = icmp eq i32* %P, null ; <i1> [#uses=1] + %P = getelementptr { i32, i32 }* %X, i32 0, i32 0 + %Q = icmp eq i32* %P, null ret i1 %Q +; CHECK: @test11 +; CHECK: icmp eq %pair* %X, null +} + + +; PR4748 +define i32 @test12(%struct.A* %a) { +entry: + %g3 = getelementptr %struct.A* %a, i32 0, i32 1 + store i32 10, i32* %g3, align 4 + + %g4 = getelementptr %struct.A* %a, i32 0, i32 0 + + %new_a = bitcast %struct.B* %g4 to %struct.A* + + %g5 = getelementptr %struct.A* %new_a, i32 0, i32 1 + %a_a = load i32* %g5, align 4 + ret i32 %a_a +; CHECK: @test12 +; CHECK: getelementptr %struct.A* %a, i64 0, i32 1 +; CHECK-NEXT: store i32 10, i32* %g3 +; CHECK-NEXT: ret i32 10 +} + + +; PR2235 +%S = type { i32, [ 100 x i32] } +define i1 @test13(i64 %X, %S* %P) { + %A = getelementptr inbounds %S* %P, i32 0, i32 1, i64 %X + %B = getelementptr inbounds %S* %P, i32 0, i32 0 + %C = icmp eq i32* %A, %B + ret i1 %C +; CHECK: @test13 +; CHECK: %C = icmp eq i64 %X, -1 +} + + +@G = external global [3 x i8] +define i8* @test14(i32 %Idx) { + %idx = zext i32 %Idx to i64 + %tmp = getelementptr i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i64 %idx + ret i8* %tmp +; CHECK: @test14 +; CHECK: getelementptr [3 x i8]* @G, i64 0, i64 %idx +} + + +; Test folding of constantexpr geps into normal geps. +@Array = external global [40 x i32] +define i32 *@test15(i64 %X) { + %A = getelementptr i32* getelementptr ([40 x i32]* @Array, i64 0, i64 0), i64 %X + ret i32* %A +; CHECK: @test15 +; CHECK: getelementptr [40 x i32]* @Array, i64 0, i64 %X +} + + +define i32* @test16(i32* %X, i32 %Idx) { + %R = getelementptr i32* %X, i32 %Idx + ret i32* %R +; CHECK: @test16 +; CHECK: sext i32 %Idx to i64 +} + + +define i1 @test17(i16* %P, i32 %I, i32 %J) { + %X = getelementptr inbounds i16* %P, i32 %I + %Y = getelementptr inbounds i16* %P, i32 %J + %C = icmp ult i16* %X, %Y + ret i1 %C +; CHECK: @test17 +; CHECK: %C = icmp slt i32 %I, %J +} + +define i1 @test18(i16* %P, i32 %I) { + %X = getelementptr inbounds i16* %P, i32 %I + %C = icmp ult i16* %X, %P + ret i1 %C +; CHECK: @test18 +; CHECK: %C = icmp slt i32 %I, 0 +} + +define i32 @test19(i32* %P, i32 %A, i32 %B) { + %tmp.4 = getelementptr inbounds i32* %P, i32 %A + %tmp.9 = getelementptr inbounds i32* %P, i32 %B + %tmp.10 = icmp eq i32* %tmp.4, %tmp.9 + %tmp.11 = zext i1 %tmp.10 to i32 + ret i32 %tmp.11 +; CHECK: @test19 +; CHECK: icmp eq i32 %A, %B +} + +define i32 @test20(i32* %P, i32 %A, i32 %B) { + %tmp.4 = getelementptr inbounds i32* %P, i32 %A + %tmp.6 = icmp eq i32* %tmp.4, %P + %tmp.7 = zext i1 %tmp.6 to i32 + ret i32 %tmp.7 +; CHECK: @test20 +; CHECK: icmp eq i32 %A, 0 +} + + +define i32 @test21() { + %pbob1 = alloca %intstruct + %pbob2 = getelementptr %intstruct* %pbob1 + %pbobel = getelementptr %intstruct* %pbob2, i64 0, i32 0 + %rval = load i32* %pbobel + ret i32 %rval +; CHECK: @test21 +; CHECK: getelementptr %intstruct* %pbob1, i64 0, i32 0 +} + + +@A = global i32 1 ; <i32*> [#uses=1] +@B = global i32 2 ; <i32*> [#uses=1] + +define i1 @test22() { + %C = icmp ult i32* getelementptr (i32* @A, i64 1), + getelementptr (i32* @B, i64 2) + ret i1 %C +; CHECK: @test22 +; CHECK: icmp ult (i32* getelementptr inbounds (i32* @A, i64 1), i32* getelementptr (i32* @B, i64 2)) +} + + +%X = type { [10 x i32], float } + +define i1 @test23() { + %A = getelementptr %X* null, i64 0, i32 0, i64 0 ; <i32*> [#uses=1] + %B = icmp ne i32* %A, null ; <i1> [#uses=1] + ret i1 %B +; CHECK: @test23 +; CHECK: ret i1 false +} + +%"java/lang/Object" = type { %struct.llvm_java_object_base } +%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } +%struct.llvm_java_object_base = type opaque + +define void @test24() { +bc0: + %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1] + store i32 0, i32* %tmp53 + ret void +; CHECK: @test24 +; CHECK: store i32 0, i32* getelementptr (%"java/lang/StringBuffer"* null, i32 0, i32 1) +} + +define void @test25() { +entry: + %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1] + %tmp.upgrd.1 = load i64* %tmp ; <i64> [#uses=1] + %tmp8.ui = load i64* null ; <i64> [#uses=1] + %tmp8 = bitcast i64 %tmp8.ui to i64 ; <i64> [#uses=1] + %tmp9 = and i64 %tmp8, %tmp.upgrd.1 ; <i64> [#uses=1] + %sext = trunc i64 %tmp9 to i32 ; <i32> [#uses=1] + %tmp27.i = sext i32 %sext to i64 ; <i64> [#uses=1] + tail call void @foo25( i32 0, i64 %tmp27.i ) + unreachable +; CHECK: @test25 +} + +declare void @foo25(i32, i64) + + +; PR1637 +define i1 @test26(i8* %arr) { + %X = getelementptr i8* %arr, i32 1 + %Y = getelementptr i8* %arr, i32 1 + %test = icmp uge i8* %X, %Y + ret i1 %test +; CHECK: @test26 +; CHECK: ret i1 true +} + + %struct.__large_struct = type { [100 x i64] } + %struct.compat_siginfo = type { i32, i32, i32, { [29 x i32] } } + %struct.siginfo_t = type { i32, i32, i32, { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] } } + %struct.sigval_t = type { i8* } + +define i32 @test27(%struct.compat_siginfo* %to, %struct.siginfo_t* %from) { +entry: + %from_addr = alloca %struct.siginfo_t* + %tmp344 = load %struct.siginfo_t** %from_addr, align 8 + %tmp345 = getelementptr %struct.siginfo_t* %tmp344, i32 0, i32 3 + %tmp346 = getelementptr { { i32, i32, [0 x i8], %struct.sigval_t, i32 }, [88 x i8] }* %tmp345, i32 0, i32 0 + %tmp346347 = bitcast { i32, i32, [0 x i8], %struct.sigval_t, i32 }* %tmp346 to { i32, i32, %struct.sigval_t }* + %tmp348 = getelementptr { i32, i32, %struct.sigval_t }* %tmp346347, i32 0, i32 2 + %tmp349 = getelementptr %struct.sigval_t* %tmp348, i32 0, i32 0 + %tmp349350 = bitcast i8** %tmp349 to i32* + %tmp351 = load i32* %tmp349350, align 8 + %tmp360 = call i32 asm sideeffect "...", + "=r,ir,*m,i,0,~{dirflag},~{fpsr},~{flags}"( i32 %tmp351, + %struct.__large_struct* null, i32 -14, i32 0 ) + unreachable +; CHECK: @test27 +} + +; PR1978 + %struct.x = type <{ i8 }> +@.str = internal constant [6 x i8] c"Main!\00" +@.str1 = internal constant [12 x i8] c"destroy %p\0A\00" + +define i32 @test28() nounwind { +entry: + %orientations = alloca [1 x [1 x %struct.x]] + %tmp3 = call i32 @puts( i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0) ) nounwind + %tmp45 = getelementptr inbounds [1 x [1 x %struct.x]]* %orientations, i32 1, i32 0, i32 0 + %orientations62 = getelementptr [1 x [1 x %struct.x]]* %orientations, i32 0, i32 0, i32 0 + br label %bb10 + +bb10: + %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb10 ] + %tmp.0.reg2mem.0.rec = mul i32 %indvar, -1 + %tmp12.rec = add i32 %tmp.0.reg2mem.0.rec, -1 + %tmp12 = getelementptr inbounds %struct.x* %tmp45, i32 %tmp12.rec + %tmp16 = call i32 (i8*, ...)* @printf( i8* getelementptr ([12 x i8]* @.str1, i32 0, i32 0), %struct.x* %tmp12 ) nounwind + %tmp84 = icmp eq %struct.x* %tmp12, %orientations62 + %indvar.next = add i32 %indvar, 1 + br i1 %tmp84, label %bb17, label %bb10 + +bb17: + ret i32 0 +; CHECK: @test28 +; CHECK: icmp eq i32 %indvar, 0 +} + +declare i32 @puts(i8*) + +declare i32 @printf(i8*, ...) + + + + +; rdar://6762290 + %T = type <{ i64, i64, i64 }> +define i32 @test29(i8* %start, i32 %X) nounwind { +entry: + %tmp3 = load i64* null + %add.ptr = getelementptr i8* %start, i64 %tmp3 + %tmp158 = load i32* null + %add.ptr159 = getelementptr %T* null, i32 %tmp158 + %add.ptr209 = getelementptr i8* %start, i64 0 + %add.ptr212 = getelementptr i8* %add.ptr209, i32 %X + %cmp214 = icmp ugt i8* %add.ptr212, %add.ptr + br i1 %cmp214, label %if.then216, label %if.end363 + +if.then216: + ret i32 1 + +if.end363: + ret i32 0 +; CHECK: @test29 +} + + +; PR3694 +define i32 @test30(i32 %m, i32 %n) nounwind { +entry: + %0 = alloca i32, i32 %n, align 4 + %1 = bitcast i32* %0 to [0 x i32]* + call void @test30f(i32* %0) nounwind + %2 = getelementptr [0 x i32]* %1, i32 0, i32 %m + %3 = load i32* %2, align 4 + ret i32 %3 +; CHECK: @test30 +; CHECK: getelementptr i32 +} + +declare void @test30f(i32*) + + + +define i1 @test31(i32* %A) { + %B = getelementptr i32* %A, i32 1 + %C = getelementptr i32* %A, i64 1 + %V = icmp eq i32* %B, %C + ret i1 %V +; CHECK: @test31 +; CHECK: ret i1 true +} + + +; PR1345 +define i8* @test32(i8* %v) { + %A = alloca [4 x i8*], align 16 + %B = getelementptr [4 x i8*]* %A, i32 0, i32 0 + store i8* null, i8** %B + %C = bitcast [4 x i8*]* %A to { [16 x i8] }* + %D = getelementptr { [16 x i8] }* %C, i32 0, i32 0, i32 8 + %E = bitcast i8* %D to i8** + store i8* %v, i8** %E + %F = getelementptr [4 x i8*]* %A, i32 0, i32 2 + %G = load i8** %F + ret i8* %G +; CHECK: @test32 +; CHECK: %D = getelementptr [4 x i8*]* %A, i64 0, i64 1 +; CHECK: %F = getelementptr [4 x i8*]* %A, i64 0, i64 2 +} + +; PR3290 +%struct.Key = type { { i32, i32 } } +%struct.anon = type <{ i8, [3 x i8], i32 }> + +define i32 *@test33(%struct.Key *%A) { + %B = bitcast %struct.Key* %A to %struct.anon* + %C = getelementptr %struct.anon* %B, i32 0, i32 2 + ret i32 *%C +; CHECK: @test33 +; CHECK: getelementptr %struct.Key* %A, i64 0, i32 0, i32 1 +} + + + + %T2 = type { i8*, i8 } +define i8* @test34(i8* %Val, i64 %V) nounwind { +entry: + %A = alloca %T2, align 8 + %mrv_gep = bitcast %T2* %A to i64* + %B = getelementptr %T2* %A, i64 0, i32 0 + + store i64 %V, i64* %mrv_gep + %C = load i8** %B, align 8 + ret i8* %C +; CHECK: @test34 +; CHECK: %V.c = inttoptr i64 %V to i8* +; CHECK: ret i8* %V.c +} + +%t0 = type { i8*, [19 x i8] } +%t1 = type { i8*, [0 x i8] } + +@array = external global [11 x i8] + +@s = external global %t0 +@"\01LC8" = external constant [17 x i8] + +; Instcombine should be able to fold this getelementptr. + +define i32 @test35() nounwind { + call i32 (i8*, ...)* @printf(i8* getelementptr ([17 x i8]* @"\01LC8", i32 0, i32 0), + i8* getelementptr (%t1* bitcast (%t0* @s to %t1*), i32 0, i32 1, i32 0)) nounwind + ret i32 0 +; CHECK: @test35 +; CHECK: call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([17 x i8]* @"\01LC8", i64 0, i64 0), i8* bitcast (i8** getelementptr (%t1* bitcast (%t0* @s to %t1*), i64 1, i32 0) to i8*)) nounwind +} + +; Instcombine should constant-fold the GEP so that indices that have +; static array extents are within bounds of those array extents. +; In the below, -1 is not in the range [0,11). After the transformation, +; the same address is computed, but 3 is in the range of [0,11). + +define i8* @test36() nounwind { + ret i8* getelementptr ([11 x i8]* @array, i32 0, i64 -1) +; CHECK: @test36 +; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4) +} + +; Instcombine shouldn't assume that gep(A,0,1) != gep(A,1,0). +@A37 = external constant [1 x i8] +define i1 @test37() nounwind { +; CHECK: @test37 +; CHECK: ret i1 true + %t = icmp eq i8* getelementptr ([1 x i8]* @A37, i64 0, i64 1), + getelementptr ([1 x i8]* @A37, i64 1, i64 0) + ret i1 %t } diff --git a/test/Transforms/InstCombine/hoist_instr.ll b/test/Transforms/InstCombine/hoist_instr.ll index e425bc2a5a909..fa451bcc72732 100644 --- a/test/Transforms/InstCombine/hoist_instr.ll +++ b/test/Transforms/InstCombine/hoist_instr.ll @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: %prcontext div 1 | grep then: +; RUN: opt < %s -instcombine -S | FileCheck %s ;; This tests that the div is hoisted into the then block. define i32 @foo(i1 %C, i32 %A, i32 %B) { @@ -7,6 +6,8 @@ entry: br i1 %C, label %then, label %endif then: ; preds = %entry +; CHECK: then: +; CHECK-NEXT: sdiv i32 br label %endif endif: ; preds = %then, %entry diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index 27136d69438df..64e88c9ae86d7 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp +; RUN: opt < %s -instcombine -S | not grep icmp define i32 @test1(i32 %X) { entry: @@ -28,3 +28,17 @@ entry: ret i32 %1 } +; PR4837 +define <2 x i1> @test5(<2 x i64> %x) { +entry: + %V = icmp eq <2 x i64> %x, undef + ret <2 x i1> %V +} + +define i32 @test6(i32 %a, i32 %b) { + %c = icmp sle i32 %a, -1 + %d = zext i1 %c to i32 + %e = sub i32 0, %d + %f = and i32 %e, %b + ret i32 %f +} diff --git a/test/Transforms/InstCombine/known_align.ll b/test/Transforms/InstCombine/known_align.ll index a6e340902dfb3..5382abf821254 100644 --- a/test/Transforms/InstCombine/known_align.ll +++ b/test/Transforms/InstCombine/known_align.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 1} +; RUN: opt < %s -instcombine -S | grep {align 1} ; END. %struct.p = type <{ i8, i32 }> diff --git a/test/Transforms/InstCombine/load.ll b/test/Transforms/InstCombine/load.ll index 85a749541e822..6d068f55dce68 100644 --- a/test/Transforms/InstCombine/load.ll +++ b/test/Transforms/InstCombine/load.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load +; RUN: opt < %s -instcombine -S | not grep load @X = constant i32 42 ; <i32*> [#uses=2] @X2 = constant i32 47 ; <i32*> [#uses=1] diff --git a/test/Transforms/InstCombine/load2.ll b/test/Transforms/InstCombine/load2.ll index 5c3cf330543b4..611b0fb1c040e 100644 --- a/test/Transforms/InstCombine/load2.ll +++ b/test/Transforms/InstCombine/load2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load +; RUN: opt < %s -instcombine -S | not grep load @GLOBAL = internal constant [4 x i32] zeroinitializer diff --git a/test/Transforms/InstCombine/load3.ll b/test/Transforms/InstCombine/load3.ll index e102d39e015d3..9c87316ece804 100644 --- a/test/Transforms/InstCombine/load3.ll +++ b/test/Transforms/InstCombine/load3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep load | count 1 +; RUN: opt < %s -instcombine -S | grep load | count 1 ; Instcombine should be able to do trivial CSE of loads. diff --git a/test/Transforms/InstCombine/loadstore-alignment.ll b/test/Transforms/InstCombine/loadstore-alignment.ll index ebea3e4fe8310..ff3401727b9c1 100644 --- a/test/Transforms/InstCombine/loadstore-alignment.ll +++ b/test/Transforms/InstCombine/loadstore-alignment.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {, align 16} | count 14 +; RUN: opt < %s -instcombine -S | grep {, align 16} | count 14 @x = external global <2 x i64>, align 16 @xx = external global [13 x <2 x i64>], align 16 diff --git a/test/Transforms/InstCombine/logical-select.ll b/test/Transforms/InstCombine/logical-select.ll index 3bb2d348b3837..ece8bc317e5a7 100644 --- a/test/Transforms/InstCombine/logical-select.ll +++ b/test/Transforms/InstCombine/logical-select.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: grep select %t | count 5 ; RUN: not grep and %t ; RUN: not grep or %t diff --git a/test/Transforms/InstCombine/lshr-phi.ll b/test/Transforms/InstCombine/lshr-phi.ll index 683eb87931efb..76a113face05e 100644 --- a/test/Transforms/InstCombine/lshr-phi.ll +++ b/test/Transforms/InstCombine/lshr-phi.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: not grep lshr %t ; RUN: grep add %t | count 1 diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index 24f793f7ca8f6..2ed5ec6996d61 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc +; RUN: opt < %s -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -instcombine -S | not grep malloc ; PR1201 define i32 @main(i32 %argc, i8** %argv) { %c_19 = alloca i8* ; <i8**> [#uses=2] diff --git a/test/Transforms/InstCombine/malloc.ll b/test/Transforms/InstCombine/malloc.ll index 6a4601a2ebeee..b6ebbeaf57530 100644 --- a/test/Transforms/InstCombine/malloc.ll +++ b/test/Transforms/InstCombine/malloc.ll @@ -1,5 +1,5 @@ ; test that malloc's with a constant argument are promoted to array allocations -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr +; RUN: opt < %s -instcombine -S | grep getelementptr define i32* @test() { %X = malloc i32, i32 4 diff --git a/test/Transforms/InstCombine/malloc2.ll b/test/Transforms/InstCombine/malloc2.ll index eb7c9abfcef50..102422ee5fc7d 100644 --- a/test/Transforms/InstCombine/malloc2.ll +++ b/test/Transforms/InstCombine/malloc2.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 0} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc +; RUN: opt < %s -instcombine -S | grep {ret i32 0} +; RUN: opt < %s -instcombine -S | not grep malloc ; PR1313 define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { diff --git a/test/Transforms/InstCombine/malloc3.ll b/test/Transforms/InstCombine/malloc3.ll index f6f412dfe062c..cd407ffb02f34 100644 --- a/test/Transforms/InstCombine/malloc3.ll +++ b/test/Transforms/InstCombine/malloc3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {malloc.*struct.foo} | count 2 +; RUN: opt < %s -instcombine -S | grep {malloc.*struct.foo} | count 2 ; PR1728 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" diff --git a/test/Transforms/InstCombine/memcpy-to-load.ll b/test/Transforms/InstCombine/memcpy-to-load.ll index 7a0027d7789fb..ebb8711af9f1e 100644 --- a/test/Transforms/InstCombine/memcpy-to-load.ll +++ b/test/Transforms/InstCombine/memcpy-to-load.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {load double} +; RUN: opt < %s -instcombine -S | grep {load double} target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin8" diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll index 09ec67d2654ea..1806cfcb54fb7 100644 --- a/test/Transforms/InstCombine/memmove.ll +++ b/test/Transforms/InstCombine/memmove.ll @@ -1,6 +1,6 @@ ; This test makes sure that memmove instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {call void @llvm.memmove} @S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1] diff --git a/test/Transforms/InstCombine/memset.ll b/test/Transforms/InstCombine/memset.ll index 27a5b60cade6e..8e85694d9ad9b 100644 --- a/test/Transforms/InstCombine/memset.ll +++ b/test/Transforms/InstCombine/memset.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {call.*llvm.memset} +; RUN: opt < %s -instcombine -S | not grep {call.*llvm.memset} declare void @llvm.memset.i32(i8*, i8, i32, i32) diff --git a/test/Transforms/InstCombine/mul-masked-bits.ll b/test/Transforms/InstCombine/mul-masked-bits.ll index 9b0a5bfe20de9..a43d5f20beaae 100644 --- a/test/Transforms/InstCombine/mul-masked-bits.ll +++ b/test/Transforms/InstCombine/mul-masked-bits.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ashr +; RUN: opt < %s -instcombine -S | grep ashr define i32 @foo(i32 %x, i32 %y) { %a = and i32 %x, 7 diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll index 9b5f7a5c5efc8..53a56434aede7 100644 --- a/test/Transforms/InstCombine/mul.ll +++ b/test/Transforms/InstCombine/mul.ll @@ -1,5 +1,5 @@ ; This test makes sure that mul instructions are properly eliminated. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul +; RUN: opt < %s -instcombine -S | not grep mul define i32 @test1(i32 %A) { %B = mul i32 %A, 1 ; <i32> [#uses=1] @@ -83,3 +83,34 @@ define internal void @test13(<4 x float>*) { store <4 x float> %3, <4 x float>* %0, align 1 ret void } + +define <16 x i8> @test14(<16 x i8> %a) { + %b = mul <16 x i8> %a, zeroinitializer + ret <16 x i8> %b +} + +; rdar://7293527 +define i32 @test15(i32 %A, i32 %B) { +entry: + %shl = shl i32 1, %B + %m = mul i32 %shl, %A + ret i32 %m +} + +; X * Y (when Y is 0 or 1) --> x & (0-Y) +define i32 @test16(i32 %b, i1 %c) { + %d = zext i1 %c to i32 ; <i32> [#uses=1] + ; e = b & (a >> 31) + %e = mul i32 %d, %b ; <i32> [#uses=1] + ret i32 %e +} + +; X * Y (when Y is 0 or 1) --> x & (0-Y) +define i32 @test17(i32 %a, i32 %b) { + %a.lobit = lshr i32 %a, 31 + %e = mul i32 %a.lobit, %b + ret i32 %e +} + + + diff --git a/test/Transforms/InstCombine/multi-use-or.ll b/test/Transforms/InstCombine/multi-use-or.ll index 48049677acd85..9bbef2383bb2a 100644 --- a/test/Transforms/InstCombine/multi-use-or.ll +++ b/test/Transforms/InstCombine/multi-use-or.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {add double .sx, .sy} +; RUN: opt < %s -instcombine -S | grep {add double .sx, .sy} ; The 'or' has multiple uses, make sure that this doesn't prevent instcombine ; from propagating the extends to the truncs. diff --git a/test/Transforms/InstCombine/narrow.ll b/test/Transforms/InstCombine/narrow.ll index 41106e759ce0e..1b96a06eeb7ff 100644 --- a/test/Transforms/InstCombine/narrow.ll +++ b/test/Transforms/InstCombine/narrow.ll @@ -1,6 +1,6 @@ ; This file contains various testcases that check to see that instcombine ; is narrowing computations when possible. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {ret i1 false} ; test1 - Eliminating the casts in this testcase (by narrowing the AND diff --git a/test/Transforms/InstCombine/no-negzero.ll b/test/Transforms/InstCombine/no-negzero.ll new file mode 100644 index 0000000000000..f295130b0ea4c --- /dev/null +++ b/test/Transforms/InstCombine/no-negzero.ll @@ -0,0 +1,33 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s +; ModuleID = '3555a.c' +; sqrt(fabs) cannot be negative zero, so we should eliminate the fadd. +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i386-apple-darwin9.8" + +; CHECK: @mysqrt +; CHECK-NOT: fadd +; CHECK: ret +define double @mysqrt(double %x) nounwind { +entry: + %x_addr = alloca double ; <double*> [#uses=2] + %retval = alloca double, align 8 ; <double*> [#uses=2] + %0 = alloca double, align 8 ; <double*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store double %x, double* %x_addr + %1 = load double* %x_addr, align 8 ; <double> [#uses=1] + %2 = call double @fabs(double %1) nounwind readnone ; <double> [#uses=1] + %3 = call double @sqrt(double %2) nounwind readonly ; <double> [#uses=1] + %4 = fadd double %3, 0.000000e+00 ; <double> [#uses=1] + store double %4, double* %0, align 8 + %5 = load double* %0, align 8 ; <double> [#uses=1] + store double %5, double* %retval, align 8 + br label %return + +return: ; preds = %entry + %retval1 = load double* %retval ; <double> [#uses=1] + ret double %retval1 +} + +declare double @fabs(double) + +declare double @sqrt(double) nounwind readonly diff --git a/test/Transforms/InstCombine/not-fcmp.ll b/test/Transforms/InstCombine/not-fcmp.ll index 4560419a35fc7..ad01a6bdf1bc1 100644 --- a/test/Transforms/InstCombine/not-fcmp.ll +++ b/test/Transforms/InstCombine/not-fcmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep "fcmp uge" +; RUN: opt < %s -instcombine -S | grep "fcmp uge" ; PR1570 define i1 @f(float %X, float %Y) { diff --git a/test/Transforms/InstCombine/not.ll b/test/Transforms/InstCombine/not.ll index a79e51871818f..c58ce11b438f6 100644 --- a/test/Transforms/InstCombine/not.ll +++ b/test/Transforms/InstCombine/not.ll @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor +; RUN: opt < %s -instcombine -S | not grep xor define i32 @test1(i32 %A) { %B = xor i32 %A, -1 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/nothrow.ll b/test/Transforms/InstCombine/nothrow.ll index fbf162a1db84d..08d90bfbd7d4f 100644 --- a/test/Transforms/InstCombine/nothrow.ll +++ b/test/Transforms/InstCombine/nothrow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep call +; RUN: opt < %s -instcombine -S | not grep call ; rdar://6880732 declare double @t1(i32) readonly diff --git a/test/Transforms/InstCombine/nsw.ll b/test/Transforms/InstCombine/nsw.ll new file mode 100644 index 0000000000000..821cebed30bba --- /dev/null +++ b/test/Transforms/InstCombine/nsw.ll @@ -0,0 +1,20 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; CHECK: define i32 @foo +; %y = sub i32 0, %x +; %z = sdiv i32 %y, 337 +; ret i32 %y +define i32 @foo(i32 %x) { + %y = sub i32 0, %x + %z = sdiv i32 %y, 337 + ret i32 %y +} + +; CHECK: define i32 @bar +; %y = sdiv i32 %x, -337 +; ret i32 %y +define i32 @bar(i32 %x) { + %y = sub nsw i32 0, %x + %z = sdiv i32 %y, 337 + ret i32 %y +} diff --git a/test/Transforms/InstCombine/odr-linkage.ll b/test/Transforms/InstCombine/odr-linkage.ll index 96f883335bcc3..a64ef289a4b65 100644 --- a/test/Transforms/InstCombine/odr-linkage.ll +++ b/test/Transforms/InstCombine/odr-linkage.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 10} +; RUN: opt < %s -instcombine -S | grep {ret i32 10} @g1 = available_externally constant i32 1 @g2 = linkonce_odr constant i32 2 diff --git a/test/Transforms/InstCombine/or-fcmp.ll b/test/Transforms/InstCombine/or-fcmp.ll index 3833c6f706fbe..9692bfcc59703 100644 --- a/test/Transforms/InstCombine/or-fcmp.ll +++ b/test/Transforms/InstCombine/or-fcmp.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fcmp | count 3 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep ret | grep 1 +; RUN: opt < %s -instcombine -S | grep fcmp | count 3 +; RUN: opt < %s -instcombine -S | grep ret | grep 1 define zeroext i8 @t1(float %x, float %y) nounwind { %a = fcmp ueq float %x, %y ; <i1> [#uses=1] diff --git a/test/Transforms/InstCombine/or-to-xor.ll b/test/Transforms/InstCombine/or-to-xor.ll index e40417b17d355..1495ee49709f0 100644 --- a/test/Transforms/InstCombine/or-to-xor.ll +++ b/test/Transforms/InstCombine/or-to-xor.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {xor i32 %a, %b} | count 4 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {and} +; RUN: opt < %s -instcombine -S | grep {xor i32 %a, %b} | count 4 +; RUN: opt < %s -instcombine -S | not grep {and} define i32 @func1(i32 %a, i32 %b) nounwind readnone { entry: diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll index e70fb1c4e0c0f..37f934bd96701 100644 --- a/test/Transforms/InstCombine/or.ll +++ b/test/Transforms/InstCombine/or.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v xor | not grep {or } ; END. diff --git a/test/Transforms/InstCombine/or2.ll b/test/Transforms/InstCombine/or2.ll index f14a274391633..c01229a78a0dd 100644 --- a/test/Transforms/InstCombine/or2.ll +++ b/test/Transforms/InstCombine/or2.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v xor | not grep {or } +; RUN: opt < %s -instcombine -S | grep -v xor | not grep {or } ; PR1738 define i1 @test1(double %X, double %Y) { diff --git a/test/Transforms/InstCombine/phi-merge-gep.ll b/test/Transforms/InstCombine/phi-merge-gep.ll new file mode 100644 index 0000000000000..267174970941d --- /dev/null +++ b/test/Transforms/InstCombine/phi-merge-gep.ll @@ -0,0 +1,102 @@ +; RUN: opt < %s -S -instcombine > %t +; RUN: grep {= getelementptr} %t | count 20 +; RUN: grep {= phi} %t | count 13 + +; Don't push the geps through these phis, because they would require +; two phis each, which burdens the loop with high register pressure. + +define void @foo(float* %Ar, float* %Ai, i64 %As, float* %Cr, float* %Ci, i64 %Cs, i64 %n) nounwind { +entry: + %0 = getelementptr inbounds float* %Ar, i64 0 ; <float*> [#uses=1] + %1 = getelementptr inbounds float* %Ai, i64 0 ; <float*> [#uses=1] + %2 = mul i64 %n, %As ; <i64> [#uses=1] + %3 = getelementptr inbounds float* %Ar, i64 %2 ; <float*> [#uses=1] + %4 = mul i64 %n, %As ; <i64> [#uses=1] + %5 = getelementptr inbounds float* %Ai, i64 %4 ; <float*> [#uses=1] + %6 = mul i64 %n, 2 ; <i64> [#uses=1] + %7 = mul i64 %6, %As ; <i64> [#uses=1] + %8 = getelementptr inbounds float* %Ar, i64 %7 ; <float*> [#uses=1] + %9 = mul i64 %n, 2 ; <i64> [#uses=1] + %10 = mul i64 %9, %As ; <i64> [#uses=1] + %11 = getelementptr inbounds float* %Ai, i64 %10 ; <float*> [#uses=1] + %12 = getelementptr inbounds float* %Cr, i64 0 ; <float*> [#uses=1] + %13 = getelementptr inbounds float* %Ci, i64 0 ; <float*> [#uses=1] + %14 = mul i64 %n, %Cs ; <i64> [#uses=1] + %15 = getelementptr inbounds float* %Cr, i64 %14 ; <float*> [#uses=1] + %16 = mul i64 %n, %Cs ; <i64> [#uses=1] + %17 = getelementptr inbounds float* %Ci, i64 %16 ; <float*> [#uses=1] + %18 = mul i64 %n, 2 ; <i64> [#uses=1] + %19 = mul i64 %18, %Cs ; <i64> [#uses=1] + %20 = getelementptr inbounds float* %Cr, i64 %19 ; <float*> [#uses=1] + %21 = mul i64 %n, 2 ; <i64> [#uses=1] + %22 = mul i64 %21, %Cs ; <i64> [#uses=1] + %23 = getelementptr inbounds float* %Ci, i64 %22 ; <float*> [#uses=1] + br label %bb13 + +bb: ; preds = %bb13 + %24 = load float* %A0r.0, align 4 ; <float> [#uses=1] + %25 = load float* %A0i.0, align 4 ; <float> [#uses=1] + %26 = load float* %A1r.0, align 4 ; <float> [#uses=2] + %27 = load float* %A1i.0, align 4 ; <float> [#uses=2] + %28 = load float* %A2r.0, align 4 ; <float> [#uses=2] + %29 = load float* %A2i.0, align 4 ; <float> [#uses=2] + %30 = fadd float %26, %28 ; <float> [#uses=2] + %31 = fadd float %27, %29 ; <float> [#uses=2] + %32 = fsub float %26, %28 ; <float> [#uses=1] + %33 = fsub float %27, %29 ; <float> [#uses=1] + %34 = fadd float %24, %30 ; <float> [#uses=2] + %35 = fadd float %25, %31 ; <float> [#uses=2] + %36 = fmul float %30, -1.500000e+00 ; <float> [#uses=1] + %37 = fmul float %31, -1.500000e+00 ; <float> [#uses=1] + %38 = fadd float %34, %36 ; <float> [#uses=2] + %39 = fadd float %35, %37 ; <float> [#uses=2] + %40 = fmul float %32, 0x3FEBB67AE0000000 ; <float> [#uses=2] + %41 = fmul float %33, 0x3FEBB67AE0000000 ; <float> [#uses=2] + %42 = fadd float %38, %41 ; <float> [#uses=1] + %43 = fsub float %39, %40 ; <float> [#uses=1] + %44 = fsub float %38, %41 ; <float> [#uses=1] + %45 = fadd float %39, %40 ; <float> [#uses=1] + store float %34, float* %C0r.0, align 4 + store float %35, float* %C0i.0, align 4 + store float %42, float* %C1r.0, align 4 + store float %43, float* %C1i.0, align 4 + store float %44, float* %C2r.0, align 4 + store float %45, float* %C2i.0, align 4 + %46 = getelementptr inbounds float* %A0r.0, i64 %As ; <float*> [#uses=1] + %47 = getelementptr inbounds float* %A0i.0, i64 %As ; <float*> [#uses=1] + %48 = getelementptr inbounds float* %A1r.0, i64 %As ; <float*> [#uses=1] + %49 = getelementptr inbounds float* %A1i.0, i64 %As ; <float*> [#uses=1] + %50 = getelementptr inbounds float* %A2r.0, i64 %As ; <float*> [#uses=1] + %51 = getelementptr inbounds float* %A2i.0, i64 %As ; <float*> [#uses=1] + %52 = getelementptr inbounds float* %C0r.0, i64 %Cs ; <float*> [#uses=1] + %53 = getelementptr inbounds float* %C0i.0, i64 %Cs ; <float*> [#uses=1] + %54 = getelementptr inbounds float* %C1r.0, i64 %Cs ; <float*> [#uses=1] + %55 = getelementptr inbounds float* %C1i.0, i64 %Cs ; <float*> [#uses=1] + %56 = getelementptr inbounds float* %C2r.0, i64 %Cs ; <float*> [#uses=1] + %57 = getelementptr inbounds float* %C2i.0, i64 %Cs ; <float*> [#uses=1] + %58 = add nsw i64 %i.0, 1 ; <i64> [#uses=1] + br label %bb13 + +bb13: ; preds = %bb, %entry + %i.0 = phi i64 [ 0, %entry ], [ %58, %bb ] ; <i64> [#uses=2] + %C2i.0 = phi float* [ %23, %entry ], [ %57, %bb ] ; <float*> [#uses=2] + %C2r.0 = phi float* [ %20, %entry ], [ %56, %bb ] ; <float*> [#uses=2] + %C1i.0 = phi float* [ %17, %entry ], [ %55, %bb ] ; <float*> [#uses=2] + %C1r.0 = phi float* [ %15, %entry ], [ %54, %bb ] ; <float*> [#uses=2] + %C0i.0 = phi float* [ %13, %entry ], [ %53, %bb ] ; <float*> [#uses=2] + %C0r.0 = phi float* [ %12, %entry ], [ %52, %bb ] ; <float*> [#uses=2] + %A2i.0 = phi float* [ %11, %entry ], [ %51, %bb ] ; <float*> [#uses=2] + %A2r.0 = phi float* [ %8, %entry ], [ %50, %bb ] ; <float*> [#uses=2] + %A1i.0 = phi float* [ %5, %entry ], [ %49, %bb ] ; <float*> [#uses=2] + %A1r.0 = phi float* [ %3, %entry ], [ %48, %bb ] ; <float*> [#uses=2] + %A0i.0 = phi float* [ %1, %entry ], [ %47, %bb ] ; <float*> [#uses=2] + %A0r.0 = phi float* [ %0, %entry ], [ %46, %bb ] ; <float*> [#uses=2] + %59 = icmp slt i64 %i.0, %n ; <i1> [#uses=1] + br i1 %59, label %bb, label %bb14 + +bb14: ; preds = %bb13 + br label %return + +return: ; preds = %bb14 + ret void +} diff --git a/test/Transforms/InstCombine/phi-merge.ll b/test/Transforms/InstCombine/phi-merge.ll index daac41274cdeb..c41f50325d6f9 100644 --- a/test/Transforms/InstCombine/phi-merge.ll +++ b/test/Transforms/InstCombine/phi-merge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {phi i32} +; RUN: opt < %s -instcombine -S | not grep {phi i32} ; PR1777 declare i1 @rrr() diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index 4efbb79d9d4ee..24eca72d4b539 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/test/Transforms/InstCombine/phi.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep phi +; RUN: opt < %s -instcombine -S | not grep phi define i32 @test1(i32 %A, i1 %b) { BB0: diff --git a/test/Transforms/InstCombine/pr2645-0.ll b/test/Transforms/InstCombine/pr2645-0.ll index 04cc1852cb2a8..9bcaa43a80bae 100644 --- a/test/Transforms/InstCombine/pr2645-0.ll +++ b/test/Transforms/InstCombine/pr2645-0.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {insertelement <4 x float> undef} +; RUN: opt < %s -instcombine -S | grep {insertelement <4 x float> undef} ; Instcombine should be able to prove that none of the ; insertelement's first operand's elements are needed. diff --git a/test/Transforms/InstCombine/pr2645-1.ll b/test/Transforms/InstCombine/pr2645-1.ll index 194d2cd18f700..d320dafcd252c 100644 --- a/test/Transforms/InstCombine/pr2645-1.ll +++ b/test/Transforms/InstCombine/pr2645-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep shufflevector +; RUN: opt < %s -instcombine -S | grep shufflevector ; PR2645 ; instcombine shouldn't delete the shufflevector. diff --git a/test/Transforms/InstCombine/pr2996.ll b/test/Transforms/InstCombine/pr2996.ll index 3e7dfa2ba6dfb..ff3245d8668cf 100644 --- a/test/Transforms/InstCombine/pr2996.ll +++ b/test/Transforms/InstCombine/pr2996.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; PR2996 define void @func_53(i16 signext %p_56) nounwind { diff --git a/test/Transforms/InstCombine/preserve-sminmax.ll b/test/Transforms/InstCombine/preserve-sminmax.ll index 24fb7dabe3d5c..dbfd56acc58b1 100644 --- a/test/Transforms/InstCombine/preserve-sminmax.ll +++ b/test/Transforms/InstCombine/preserve-sminmax.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep { i32 \[%\]sd, \[\[:alnum:\]\]* \\?1\\>} | count 4 +; RUN: opt < %s -instcombine -S | grep { i32 \[%\]sd, \[\[:alnum:\]\]* \\?1\\>} | count 4 ; Instcombine normally would fold the sdiv into the comparison, ; making "icmp slt i32 %h, 2", but in this case the sdiv has diff --git a/test/Transforms/InstCombine/ptr-int-cast.ll b/test/Transforms/InstCombine/ptr-int-cast.ll index 5c154397775e3..2f64d8ba0e1d6 100644 --- a/test/Transforms/InstCombine/ptr-int-cast.ll +++ b/test/Transforms/InstCombine/ptr-int-cast.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t define i1 @test1(i32 *%x) nounwind { entry: diff --git a/test/Transforms/InstCombine/rem.ll b/test/Transforms/InstCombine/rem.ll index 8b2263d9b23f8..bac248e58d7ab 100644 --- a/test/Transforms/InstCombine/rem.ll +++ b/test/Transforms/InstCombine/rem.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep rem +; RUN: opt < %s -instcombine -S | not grep rem ; END. define i32 @test1(i32 %A) { diff --git a/test/Transforms/InstCombine/sdiv-1.ll b/test/Transforms/InstCombine/sdiv-1.ll index 305b6d7df927f..c46b5eaef4a87 100644 --- a/test/Transforms/InstCombine/sdiv-1.ll +++ b/test/Transforms/InstCombine/sdiv-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -inline | llvm-dis | not grep '-715827882' +; RUN: opt < %s -instcombine -inline -S | not grep '-715827882' ; PR3142 define i32 @a(i32 %X) nounwind readnone { diff --git a/test/Transforms/InstCombine/sdiv-2.ll b/test/Transforms/InstCombine/sdiv-2.ll index db0c7fbccf8e8..0e4c008020103 100644 --- a/test/Transforms/InstCombine/sdiv-2.ll +++ b/test/Transforms/InstCombine/sdiv-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine -disable-output +; RUN: opt < %s -instcombine -disable-output ; PR3144 define fastcc i32 @func(i32 %length) nounwind { diff --git a/test/Transforms/InstCombine/sdiv-shift.ll b/test/Transforms/InstCombine/sdiv-shift.ll new file mode 100644 index 0000000000000..f4d2b36cbbf8d --- /dev/null +++ b/test/Transforms/InstCombine/sdiv-shift.ll @@ -0,0 +1,9 @@ +; RUN: opt < %s -instcombine -S | not grep div + +define i32 @a(i16 zeroext %x, i32 %y) nounwind { +entry: + %conv = zext i16 %x to i32 + %s = shl i32 2, %y + %d = sdiv i32 %conv, %s + ret i32 %d +} diff --git a/test/Transforms/InstCombine/select-2.ll b/test/Transforms/InstCombine/select-2.ll index 4621f6e152ad3..a76addc9942b0 100644 --- a/test/Transforms/InstCombine/select-2.ll +++ b/test/Transforms/InstCombine/select-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2 +; RUN: opt < %s -instcombine -S | grep select | count 2 ; Make sure instcombine don't fold select into operands. We don't want to emit ; select of two integers unless it's selecting 0 / 1. diff --git a/test/Transforms/InstCombine/select-load-call.ll b/test/Transforms/InstCombine/select-load-call.ll index 367356e6311a2..bef0cf841bfaa 100644 --- a/test/Transforms/InstCombine/select-load-call.ll +++ b/test/Transforms/InstCombine/select-load-call.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 1} +; RUN: opt < %s -instcombine -S | grep {ret i32 1} declare void @test2() diff --git a/test/Transforms/InstCombine/select.ll b/test/Transforms/InstCombine/select.ll index 15083f2facd2b..b04382e8b1132 100644 --- a/test/Transforms/InstCombine/select.ll +++ b/test/Transforms/InstCombine/select.ll @@ -1,7 +1,7 @@ ; This test makes sure that these instructions are properly eliminated. ; PR1822 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select +; RUN: opt < %s -instcombine -S | not grep select define i32 @test1(i32 %A, i32 %B) { %C = select i1 false, i32 %A, i32 %B ; <i32> [#uses=1] @@ -202,3 +202,64 @@ define i1 @test24(i1 %a, i1 %b) { ret i1 %c } +define i32 @test25(i1 %c) { +entry: + br i1 %c, label %jump, label %ret +jump: + br label %ret +ret: + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 10, i32 20 + ret i32 %b +} + +define i32 @test26(i1 %cond) { +entry: + br i1 %cond, label %jump, label %ret +jump: + %c = or i1 false, false + br label %ret +ret: + %a = phi i1 [true, %jump], [%c, %entry] + %b = select i1 %a, i32 10, i32 20 + ret i32 %b +} + +define i32 @test27(i1 %c, i32 %A, i32 %B) { +entry: + br i1 %c, label %jump, label %ret +jump: + br label %ret +ret: + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 %A, i32 %B + ret i32 %b +} + +define i32 @test28(i1 %cond, i32 %A, i32 %B) { +entry: + br i1 %cond, label %jump, label %ret +jump: + br label %ret +ret: + %c = phi i32 [%A, %jump], [%B, %entry] + %a = phi i1 [true, %jump], [false, %entry] + %b = select i1 %a, i32 %A, i32 %c + ret i32 %b +} + +define i32 @test29(i1 %cond, i32 %A, i32 %B) { +entry: + br i1 %cond, label %jump, label %ret +jump: + br label %ret +ret: + %c = phi i32 [%A, %jump], [%B, %entry] + %a = phi i1 [true, %jump], [false, %entry] + br label %next + +next: + %b = select i1 %a, i32 %A, i32 %c + ret i32 %b +} + diff --git a/test/Transforms/InstCombine/set.ll b/test/Transforms/InstCombine/set.ll index 5e3ca0b51b898..daa9148f6ad97 100644 --- a/test/Transforms/InstCombine/set.ll +++ b/test/Transforms/InstCombine/set.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep icmp +; RUN: opt < %s -instcombine -S | not grep icmp ; END. @X = external global i32 ; <i32*> [#uses=2] diff --git a/test/Transforms/InstCombine/setcc-cast-cast.ll b/test/Transforms/InstCombine/setcc-cast-cast.ll index ed2e2bee551e5..b2681ea298633 100644 --- a/test/Transforms/InstCombine/setcc-cast-cast.ll +++ b/test/Transforms/InstCombine/setcc-cast-cast.ll @@ -1,7 +1,7 @@ ; This test case was reduced from MultiSource/Applications/hbd. It makes sure ; that folding doesn't happen in case a zext is applied where a sext should have ; been when a setcc is used with two casts. -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {br i1 false} ; END. diff --git a/test/Transforms/InstCombine/setcc-strength-reduce.ll b/test/Transforms/InstCombine/setcc-strength-reduce.ll index 9931ccb2fd259..62ab116367fe0 100644 --- a/test/Transforms/InstCombine/setcc-strength-reduce.ll +++ b/test/Transforms/InstCombine/setcc-strength-reduce.ll @@ -2,7 +2,7 @@ ; working. Basically this boils down to converting setlt,gt,le,ge instructions ; into equivalent setne,eq instructions. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v {icmp eq} | grep -v {icmp ne} | not grep icmp ; END. diff --git a/test/Transforms/InstCombine/sext-misc.ll b/test/Transforms/InstCombine/sext-misc.ll index 58749666ea1b5..107bba6e843fe 100644 --- a/test/Transforms/InstCombine/sext-misc.ll +++ b/test/Transforms/InstCombine/sext-misc.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext +; RUN: opt < %s -instcombine -S | not grep sext declare i32 @llvm.ctpop.i32(i32) declare i32 @llvm.ctlz.i32(i32) diff --git a/test/Transforms/InstCombine/shift-simplify.ll b/test/Transforms/InstCombine/shift-simplify.ll index ecf3f5f92fef5..e5cc705350f9c 100644 --- a/test/Transforms/InstCombine/shift-simplify.ll +++ b/test/Transforms/InstCombine/shift-simplify.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: egrep {shl|lshr|ashr} | count 3 define i32 @test0(i32 %A, i32 %B, i32 %C) { diff --git a/test/Transforms/InstCombine/shift-sra.ll b/test/Transforms/InstCombine/shift-sra.ll index 6058bd6dc7241..449278544d1f1 100644 --- a/test/Transforms/InstCombine/shift-sra.ll +++ b/test/Transforms/InstCombine/shift-sra.ll @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {lshr i32} | count 2 -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr +; RUN: opt < %s -instcombine -S | not grep ashr define i32 @test1(i32 %X, i8 %A) { diff --git a/test/Transforms/InstCombine/shift-trunc-shift.ll b/test/Transforms/InstCombine/shift-trunc-shift.ll index bf9f4070fb984..7133d299a2bde 100644 --- a/test/Transforms/InstCombine/shift-trunc-shift.ll +++ b/test/Transforms/InstCombine/shift-trunc-shift.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep lshr.*63 +; RUN: opt < %s -instcombine -S | grep lshr.*63 define i32 @t1(i64 %d18) { entry: diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 9dc7755c1b8bc..feed37bd10ab5 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -1,25 +1,32 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sh -; END. +; RUN: opt < %s -instcombine -S | FileCheck %s define i32 @test1(i32 %A) { +; CHECK: @test1 +; CHECK: ret i32 %A %B = shl i32 %A, 0 ; <i32> [#uses=1] ret i32 %B } define i32 @test2(i8 %A) { +; CHECK: @test2 +; CHECK: ret i32 0 %shift.upgrd.1 = zext i8 %A to i32 ; <i32> [#uses=1] %B = shl i32 0, %shift.upgrd.1 ; <i32> [#uses=1] ret i32 %B } define i32 @test3(i32 %A) { +; CHECK: @test3 +; CHECK: ret i32 %A %B = ashr i32 %A, 0 ; <i32> [#uses=1] ret i32 %B } define i32 @test4(i8 %A) { +; CHECK: @test4 +; CHECK: ret i32 0 %shift.upgrd.2 = zext i8 %A to i32 ; <i32> [#uses=1] %B = ashr i32 0, %shift.upgrd.2 ; <i32> [#uses=1] ret i32 %B @@ -27,22 +34,31 @@ define i32 @test4(i8 %A) { define i32 @test5(i32 %A) { +; CHECK: @test5 +; CHECK: ret i32 0 %B = lshr i32 %A, 32 ;; shift all bits out ret i32 %B } define i32 @test5a(i32 %A) { +; CHECK: @test5a +; CHECK: ret i32 0 %B = shl i32 %A, 32 ;; shift all bits out ret i32 %B } define i32 @test6(i32 %A) { +; CHECK: @test6 +; CHECK-NEXT: mul i32 %A, 6 +; CHECK-NEXT: ret i32 %B = shl i32 %A, 1 ;; convert to an mul instruction %C = mul i32 %B, 3 ret i32 %C } define i32 @test7(i8 %A) { +; CHECK: @test7 +; CHECK-NEXT: ret i32 -1 %shift.upgrd.3 = zext i8 %A to i32 %B = ashr i32 -1, %shift.upgrd.3 ;; Always equal to -1 ret i32 %B @@ -50,6 +66,8 @@ define i32 @test7(i8 %A) { ;; (A << 5) << 3 === A << 8 == 0 define i8 @test8(i8 %A) { +; CHECK: @test8 +; CHECK: ret i8 0 %B = shl i8 %A, 5 ; <i8> [#uses=1] %C = shl i8 %B, 3 ; <i8> [#uses=1] ret i8 %C @@ -57,6 +75,9 @@ define i8 @test8(i8 %A) { ;; (A << 7) >> 7 === A & 1 define i8 @test9(i8 %A) { +; CHECK: @test9 +; CHECK-NEXT: and i8 %A, 1 +; CHECK-NEXT: ret i8 %B = shl i8 %A, 7 ; <i8> [#uses=1] %C = lshr i8 %B, 7 ; <i8> [#uses=1] ret i8 %C @@ -64,6 +85,9 @@ define i8 @test9(i8 %A) { ;; (A >> 7) << 7 === A & 128 define i8 @test10(i8 %A) { +; CHECK: @test10 +; CHECK-NEXT: and i8 %A, -128 +; CHECK-NEXT: ret i8 %B = lshr i8 %A, 7 ; <i8> [#uses=1] %C = shl i8 %B, 7 ; <i8> [#uses=1] ret i8 %C @@ -71,6 +95,10 @@ define i8 @test10(i8 %A) { ;; (A >> 3) << 4 === (A & 0x1F) << 1 define i8 @test11(i8 %A) { +; CHECK: @test11 +; CHECK-NEXT: mul i8 %A, 6 +; CHECK-NEXT: and i8 +; CHECK-NEXT: ret i8 %a = mul i8 %A, 3 ; <i8> [#uses=1] %B = lshr i8 %a, 3 ; <i8> [#uses=1] %C = shl i8 %B, 4 ; <i8> [#uses=1] @@ -79,6 +107,9 @@ define i8 @test11(i8 %A) { ;; (A >> 8) << 8 === A & -256 define i32 @test12(i32 %A) { +; CHECK: @test12 +; CHECK-NEXT: and i32 %A, -256 +; CHECK-NEXT: ret i32 %B = ashr i32 %A, 8 ; <i32> [#uses=1] %C = shl i32 %B, 8 ; <i32> [#uses=1] ret i32 %C @@ -86,6 +117,10 @@ define i32 @test12(i32 %A) { ;; (A >> 3) << 4 === (A & -8) * 2 define i8 @test13(i8 %A) { +; CHECK: @test13 +; CHECK-NEXT: mul i8 %A, 6 +; CHECK-NEXT: and i8 +; CHECK-NEXT: ret i8 %a = mul i8 %A, 3 ; <i8> [#uses=1] %B = ashr i8 %a, 3 ; <i8> [#uses=1] %C = shl i8 %B, 4 ; <i8> [#uses=1] @@ -94,6 +129,10 @@ define i8 @test13(i8 %A) { ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4) define i32 @test14(i32 %A) { +; CHECK: @test14 +; CHECK-NEXT: or i32 %A, 19744 +; CHECK-NEXT: and i32 +; CHECK-NEXT: ret i32 %B = lshr i32 %A, 4 ; <i32> [#uses=1] %C = or i32 %B, 1234 ; <i32> [#uses=1] %D = shl i32 %C, 4 ; <i32> [#uses=1] @@ -102,6 +141,9 @@ define i32 @test14(i32 %A) { ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4) define i32 @test14a(i32 %A) { +; CHECK: @test14a +; CHECK-NEXT: and i32 %A, 77 +; CHECK-NEXT: ret i32 %B = shl i32 %A, 4 ; <i32> [#uses=1] %C = and i32 %B, 1234 ; <i32> [#uses=1] %D = lshr i32 %C, 4 ; <i32> [#uses=1] @@ -109,12 +151,18 @@ define i32 @test14a(i32 %A) { } define i32 @test15(i1 %C) { +; CHECK: @test15 +; CHECK-NEXT: select i1 %C, i32 12, i32 4 +; CHECK-NEXT: ret i32 %A = select i1 %C, i32 3, i32 1 ; <i32> [#uses=1] %V = shl i32 %A, 2 ; <i32> [#uses=1] ret i32 %V } define i32 @test15a(i1 %C) { +; CHECK: @test15a +; CHECK-NEXT: select i1 %C, i32 512, i32 128 +; CHECK-NEXT: ret i32 %A = select i1 %C, i8 3, i8 1 ; <i8> [#uses=1] %shift.upgrd.4 = zext i8 %A to i32 ; <i32> [#uses=1] %V = shl i32 64, %shift.upgrd.4 ; <i32> [#uses=1] @@ -122,13 +170,21 @@ define i32 @test15a(i1 %C) { } define i1 @test16(i32 %X) { - %tmp.3 = ashr i32 %X, 4 ; <i32> [#uses=1] - %tmp.6 = and i32 %tmp.3, 1 ; <i32> [#uses=1] - %tmp.7 = icmp ne i32 %tmp.6, 0 ; <i1> [#uses=1] +; CHECK: @test16 +; CHECK-NEXT: and i32 %X, 16 +; CHECK-NEXT: icmp ne i32 +; CHECK-NEXT: ret i1 + %tmp.3 = ashr i32 %X, 4 + %tmp.6 = and i32 %tmp.3, 1 + %tmp.7 = icmp ne i32 %tmp.6, 0 ret i1 %tmp.7 } define i1 @test17(i32 %A) { +; CHECK: @test17 +; CHECK-NEXT: and i32 %A, -8 +; CHECK-NEXT: icmp eq i32 +; CHECK-NEXT: ret i1 %B = lshr i32 %A, 3 ; <i32> [#uses=1] %C = icmp eq i32 %B, 1234 ; <i1> [#uses=1] ret i1 %C @@ -136,6 +192,9 @@ define i1 @test17(i32 %A) { define i1 @test18(i8 %A) { +; CHECK: @test18 +; CHECK: ret i1 false + %B = lshr i8 %A, 7 ; <i8> [#uses=1] ;; false %C = icmp eq i8 %B, 123 ; <i1> [#uses=1] @@ -143,6 +202,9 @@ define i1 @test18(i8 %A) { } define i1 @test19(i32 %A) { +; CHECK: @test19 +; CHECK-NEXT: icmp ult i32 %A, 4 +; CHECK-NEXT: ret i1 %B = ashr i32 %A, 2 ; <i32> [#uses=1] ;; (X & -4) == 0 %C = icmp eq i32 %B, 0 ; <i1> [#uses=1] @@ -151,6 +213,10 @@ define i1 @test19(i32 %A) { define i1 @test19a(i32 %A) { +; CHECK: @test19a +; CHECK-NEXT: and i32 %A, -4 +; CHECK-NEXT: icmp eq i32 +; CHECK-NEXT: ret i1 %B = ashr i32 %A, 2 ; <i32> [#uses=1] ;; (X & -4) == -4 %C = icmp eq i32 %B, -1 ; <i1> [#uses=1] @@ -158,6 +224,8 @@ define i1 @test19a(i32 %A) { } define i1 @test20(i8 %A) { +; CHECK: @test20 +; CHECK: ret i1 false %B = ashr i8 %A, 7 ; <i8> [#uses=1] ;; false %C = icmp eq i8 %B, 123 ; <i1> [#uses=1] @@ -165,18 +233,30 @@ define i1 @test20(i8 %A) { } define i1 @test21(i8 %A) { +; CHECK: @test21 +; CHECK-NEXT: and i8 %A, 15 +; CHECK-NEXT: icmp eq i8 +; CHECK-NEXT: ret i1 %B = shl i8 %A, 4 ; <i8> [#uses=1] %C = icmp eq i8 %B, -128 ; <i1> [#uses=1] ret i1 %C } define i1 @test22(i8 %A) { +; CHECK: @test22 +; CHECK-NEXT: and i8 %A, 15 +; CHECK-NEXT: icmp eq i8 +; CHECK-NEXT: ret i1 %B = shl i8 %A, 4 ; <i8> [#uses=1] %C = icmp eq i8 %B, 0 ; <i1> [#uses=1] ret i1 %C } define i8 @test23(i32 %A) { +; CHECK: @test23 +; CHECK-NEXT: trunc i32 %A to i8 +; CHECK-NEXT: ret i8 + ;; casts not needed %B = shl i32 %A, 24 ; <i32> [#uses=1] %C = ashr i32 %B, 24 ; <i32> [#uses=1] @@ -185,6 +265,9 @@ define i8 @test23(i32 %A) { } define i8 @test24(i8 %X) { +; CHECK: @test24 +; CHECK-NEXT: and i8 %X, 3 +; CHECK-NEXT: ret i8 %Y = and i8 %X, -5 ; <i8> [#uses=1] %Z = shl i8 %Y, 5 ; <i8> [#uses=1] %Q = ashr i8 %Z, 5 ; <i8> [#uses=1] @@ -192,6 +275,11 @@ define i8 @test24(i8 %X) { } define i32 @test25(i32 %tmp.2, i32 %AA) { +; CHECK: @test25 +; CHECK-NEXT: and i32 %tmp.2, -131072 +; CHECK-NEXT: add i32 %{{[^,]*}}, %AA +; CHECK-NEXT: and i32 %{{[^,]*}}, -131072 +; CHECK-NEXT: ret i32 %x = lshr i32 %AA, 17 ; <i32> [#uses=1] %tmp.3 = lshr i32 %tmp.2, 17 ; <i32> [#uses=1] %tmp.5 = add i32 %tmp.3, %x ; <i32> [#uses=1] @@ -201,6 +289,9 @@ define i32 @test25(i32 %tmp.2, i32 %AA) { ;; handle casts between shifts. define i32 @test26(i32 %A) { +; CHECK: @test26 +; CHECK-NEXT: and i32 %A, -2 +; CHECK-NEXT: ret i32 %B = lshr i32 %A, 1 ; <i32> [#uses=1] %C = bitcast i32 %B to i32 ; <i32> [#uses=1] %D = shl i32 %C, 1 ; <i32> [#uses=1] @@ -209,8 +300,46 @@ define i32 @test26(i32 %A) { define i1 @test27(i32 %x) nounwind { +; CHECK: @test27 +; CHECK-NEXT: and i32 %x, 8 +; CHECK-NEXT: icmp ne i32 +; CHECK-NEXT: ret i1 %y = lshr i32 %x, 3 %z = trunc i32 %y to i1 ret i1 %z } +define i8 @test28(i8 %x) { +entry: +; CHECK: @test28 +; CHECK: icmp slt i8 %x, 0 +; CHECK-NEXT: br i1 + %tmp1 = lshr i8 %x, 7 + %cond1 = icmp ne i8 %tmp1, 0 + br i1 %cond1, label %bb1, label %bb2 + +bb1: + ret i8 0 + +bb2: + ret i8 1 +} + +define i8 @test28a(i8 %x, i8 %y) { +entry: +; This shouldn't be transformed. +; CHECK: @test28a +; CHECK: %tmp1 = lshr i8 %x, 7 +; CHECK: %cond1 = icmp eq i8 %tmp1, 0 +; CHECK: br i1 %cond1, label %bb2, label %bb1 + %tmp1 = lshr i8 %x, 7 + %cond1 = icmp ne i8 %tmp1, 0 + br i1 %cond1, label %bb1, label %bb2 +bb1: + ret i8 %tmp1 +bb2: + %tmp2 = add i8 %tmp1, %y + ret i8 %tmp2 +} + + diff --git a/test/Transforms/InstCombine/shufflemask-undef.ll b/test/Transforms/InstCombine/shufflemask-undef.ll index a9e8d34958871..cf87aef7df465 100644 --- a/test/Transforms/InstCombine/shufflemask-undef.ll +++ b/test/Transforms/InstCombine/shufflemask-undef.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {shufflevector.\*i32 8} +; RUN: opt < %s -instcombine -S | not grep {shufflevector.\*i32 8} target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9" diff --git a/test/Transforms/InstCombine/shufflevec-constant.ll b/test/Transforms/InstCombine/shufflevec-constant.ll index f153a484fa01b..2c667903b1ebf 100644 --- a/test/Transforms/InstCombine/shufflevec-constant.ll +++ b/test/Transforms/InstCombine/shufflevec-constant.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep "2 x float" +; RUN: opt < %s -instcombine -S | grep "2 x float" target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9" diff --git a/test/Transforms/InstCombine/signed-comparison.ll b/test/Transforms/InstCombine/signed-comparison.ll index 86e07ec7ce15b..9a08c6446c528 100644 --- a/test/Transforms/InstCombine/signed-comparison.ll +++ b/test/Transforms/InstCombine/signed-comparison.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: not grep zext %t ; RUN: not grep slt %t ; RUN: grep {icmp ult} %t diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll index 716662682da32..008662e04e9df 100644 --- a/test/Transforms/InstCombine/signext.ll +++ b/test/Transforms/InstCombine/signext.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {(and\|xor\|add\|shl\|shr)} ; END. diff --git a/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll b/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll new file mode 100644 index 0000000000000..6d2193fe448ae --- /dev/null +++ b/test/Transforms/InstCombine/simplify-demanded-bits-pointer.ll @@ -0,0 +1,84 @@ +; RUN: opt < %s -instcombine -disable-output + +; SimplifyDemandedBits should cope with pointer types. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" +target triple = "x86_64-unknown-linux-gnu" + %struct.VEC_rtx_base = type { i32, i32, [1 x %struct.rtx_def*] } + %struct.VEC_rtx_gc = type { %struct.VEC_rtx_base } + %struct.block_symbol = type { [3 x %struct.rtunion], %struct.object_block*, i64 } + %struct.object_block = type { %struct.section*, i32, i64, %struct.VEC_rtx_gc*, %struct.VEC_rtx_gc* } + %struct.omp_clause_subcode = type { i32 } + %struct.rtunion = type { i8* } + %struct.rtx_def = type { i16, i8, i8, %struct.u } + %struct.section = type { %struct.unnamed_section } + %struct.u = type { %struct.block_symbol } + %struct.unnamed_section = type { %struct.omp_clause_subcode, void (i8*)*, i8*, %struct.section* } + +define fastcc void @cse_insn(%struct.rtx_def* %insn, %struct.rtx_def* %libcall_insn) nounwind { +entry: + br i1 undef, label %bb43, label %bb88 + +bb43: ; preds = %entry + br label %bb88 + +bb88: ; preds = %bb43, %entry + br i1 undef, label %bb95, label %bb107 + +bb95: ; preds = %bb88 + unreachable + +bb107: ; preds = %bb88 + %0 = load i16* undef, align 8 ; <i16> [#uses=1] + %1 = icmp eq i16 %0, 38 ; <i1> [#uses=1] + %src_eqv_here.0 = select i1 %1, %struct.rtx_def* null, %struct.rtx_def* null ; <%struct.rtx_def*> [#uses=1] + br i1 undef, label %bb127, label %bb125 + +bb125: ; preds = %bb107 + br i1 undef, label %bb127, label %bb126 + +bb126: ; preds = %bb125 + br i1 undef, label %bb129, label %bb133 + +bb127: ; preds = %bb125, %bb107 + unreachable + +bb129: ; preds = %bb126 + br label %bb133 + +bb133: ; preds = %bb129, %bb126 + br i1 undef, label %bb134, label %bb146 + +bb134: ; preds = %bb133 + unreachable + +bb146: ; preds = %bb133 + br i1 undef, label %bb180, label %bb186 + +bb180: ; preds = %bb146 + %2 = icmp eq %struct.rtx_def* null, null ; <i1> [#uses=1] + %3 = zext i1 %2 to i8 ; <i8> [#uses=1] + %4 = icmp ne %struct.rtx_def* %src_eqv_here.0, null ; <i1> [#uses=1] + %5 = zext i1 %4 to i8 ; <i8> [#uses=1] + %toBool181 = icmp ne i8 %3, 0 ; <i1> [#uses=1] + %toBool182 = icmp ne i8 %5, 0 ; <i1> [#uses=1] + %6 = and i1 %toBool181, %toBool182 ; <i1> [#uses=1] + %7 = zext i1 %6 to i8 ; <i8> [#uses=1] + %toBool183 = icmp ne i8 %7, 0 ; <i1> [#uses=1] + br i1 %toBool183, label %bb184, label %bb186 + +bb184: ; preds = %bb180 + br i1 undef, label %bb185, label %bb186 + +bb185: ; preds = %bb184 + br label %bb186 + +bb186: ; preds = %bb185, %bb184, %bb180, %bb146 + br i1 undef, label %bb190, label %bb195 + +bb190: ; preds = %bb186 + unreachable + +bb195: ; preds = %bb186 + unreachable +} diff --git a/test/Transforms/InstCombine/sink_instruction.ll b/test/Transforms/InstCombine/sink_instruction.ll index cb8a090e5a07f..e521de208f216 100644 --- a/test/Transforms/InstCombine/sink_instruction.ll +++ b/test/Transforms/InstCombine/sink_instruction.ll @@ -1,10 +1,10 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: %prcontext div 1 | grep ret +; RUN: opt -instcombine %s -S | FileCheck %s ;; This tests that the instructions in the entry blocks are sunk into each ;; arm of the 'if'. -define i32 @foo(i1 %C, i32 %A, i32 %B) { +define i32 @test1(i1 %C, i32 %A, i32 %B) { +; CHECK: @test1 entry: %tmp.2 = sdiv i32 %A, %B ; <i32> [#uses=1] %tmp.9 = add i32 %B, %A ; <i32> [#uses=1] @@ -14,6 +14,43 @@ then: ; preds = %entry ret i32 %tmp.9 endif: ; preds = %entry +; CHECK: sdiv i32 +; CHECK-NEXT: ret i32 ret i32 %tmp.2 } + +;; PHI use, sink divide before call. +define i32 @test2(i32 %x) nounwind ssp { +; CHECK: @test2 +; CHECK-NOT: sdiv i32 +entry: + br label %bb + +bb: ; preds = %bb2, %entry + %x_addr.17 = phi i32 [ %x, %entry ], [ %x_addr.0, %bb2 ] ; <i32> [#uses=4] + %i.06 = phi i32 [ 0, %entry ], [ %4, %bb2 ] ; <i32> [#uses=1] + %0 = add nsw i32 %x_addr.17, 1 ; <i32> [#uses=1] + %1 = sdiv i32 %0, %x_addr.17 ; <i32> [#uses=1] + %2 = icmp eq i32 %x_addr.17, 0 ; <i1> [#uses=1] + br i1 %2, label %bb1, label %bb2 + +bb1: ; preds = %bb +; CHECK: bb1: +; CHECK-NEXT: add nsw i32 %x_addr.17, 1 +; CHECK-NEXT: sdiv i32 +; CHECK-NEXT: tail call i32 @bar() + %3 = tail call i32 @bar() nounwind ; <i32> [#uses=0] + br label %bb2 + +bb2: ; preds = %bb, %bb1 + %x_addr.0 = phi i32 [ %1, %bb1 ], [ %x_addr.17, %bb ] ; <i32> [#uses=2] + %4 = add nsw i32 %i.06, 1 ; <i32> [#uses=2] + %exitcond = icmp eq i32 %4, 1000000 ; <i1> [#uses=1] + br i1 %exitcond, label %bb4, label %bb + +bb4: ; preds = %bb2 + ret i32 %x_addr.0 +} + +declare i32 @bar() diff --git a/test/Transforms/InstCombine/sitofp.ll b/test/Transforms/InstCombine/sitofp.ll index 2bf7385cddff7..bd31b89f7879a 100644 --- a/test/Transforms/InstCombine/sitofp.ll +++ b/test/Transforms/InstCombine/sitofp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep itofp +; RUN: opt < %s -instcombine -S | not grep itofp define i1 @test1(i8 %A) { %B = sitofp i8 %A to double diff --git a/test/Transforms/InstCombine/srem-simplify-bug.ll b/test/Transforms/InstCombine/srem-simplify-bug.ll index cdf520256837d..af824a445df0e 100644 --- a/test/Transforms/InstCombine/srem-simplify-bug.ll +++ b/test/Transforms/InstCombine/srem-simplify-bug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 false} +; RUN: opt < %s -instcombine -S | grep {ret i1 false} ; PR2276 define i1 @f(i32 %x) { diff --git a/test/Transforms/InstCombine/srem.ll b/test/Transforms/InstCombine/srem.ll index 864775ae08a10..beefe4fb8d3fa 100644 --- a/test/Transforms/InstCombine/srem.ll +++ b/test/Transforms/InstCombine/srem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem +; RUN: opt < %s -instcombine -S | grep srem define i64 @foo(i64 %x1, i64 %y2) { %r = sdiv i64 %x1, %y2 diff --git a/test/Transforms/InstCombine/srem1.ll b/test/Transforms/InstCombine/srem1.ll index ee59d3ed99f81..f18690c3fff27 100644 --- a/test/Transforms/InstCombine/srem1.ll +++ b/test/Transforms/InstCombine/srem1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine +; RUN: opt < %s -instcombine ; PR2670 @g_127 = external global i32 ; <i32*> [#uses=1] diff --git a/test/Transforms/InstCombine/stack-overalign.ll b/test/Transforms/InstCombine/stack-overalign.ll index 45bdc2e0cbe89..88b4114d58850 100644 --- a/test/Transforms/InstCombine/stack-overalign.ll +++ b/test/Transforms/InstCombine/stack-overalign.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {align 32} | count 1 +; RUN: opt < %s -instcombine -S | grep {align 32} | count 1 ; It's tempting to have an instcombine in which the src pointer of a ; memcpy is aligned up to the alignment of the destination, however diff --git a/test/Transforms/InstCombine/stacksaverestore.ll b/test/Transforms/InstCombine/stacksaverestore.ll index c82a425b2fd04..0fcaefac62248 100644 --- a/test/Transforms/InstCombine/stacksaverestore.ll +++ b/test/Transforms/InstCombine/stacksaverestore.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call.*stackrestore} | count 1 +; RUN: opt < %s -instcombine -S | grep {call.*stackrestore} | count 1 declare i8* @llvm.stacksave() declare void @llvm.stackrestore(i8*) diff --git a/test/Transforms/InstCombine/store-merge.ll b/test/Transforms/InstCombine/store-merge.ll index 7b117ca7f5f95..06d497d10dbf4 100644 --- a/test/Transforms/InstCombine/store-merge.ll +++ b/test/Transforms/InstCombine/store-merge.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {ret i32 %.toremerge} | count 2 ;; Simple sinking tests diff --git a/test/Transforms/InstCombine/store.ll b/test/Transforms/InstCombine/store.ll index 337b2cce08aa3..d6f916dc8c7f2 100644 --- a/test/Transforms/InstCombine/store.ll +++ b/test/Transforms/InstCombine/store.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v {store.*,.*null} | not grep store define void @test1(i32* %P) { diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll index 1ab4eaf1b49d1..bd7a700e22ee6 100644 --- a/test/Transforms/InstCombine/sub.ll +++ b/test/Transforms/InstCombine/sub.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep -v {sub i32 %Cok, %Bok} | grep -v {sub i32 0, %Aok} | not grep sub define i32 @test1(i32 %A) { diff --git a/test/Transforms/InstCombine/trunc-mask-ext.ll b/test/Transforms/InstCombine/trunc-mask-ext.ll index 7e3d8446acffc..93e3753cf5023 100644 --- a/test/Transforms/InstCombine/trunc-mask-ext.ll +++ b/test/Transforms/InstCombine/trunc-mask-ext.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t +; RUN: opt < %s -instcombine -S > %t ; RUN: not grep zext %t ; RUN: not grep sext %t diff --git a/test/Transforms/InstCombine/udiv-simplify-bug-0.ll b/test/Transforms/InstCombine/udiv-simplify-bug-0.ll index 5bcaa66366c7b..bfdd98cddfafa 100644 --- a/test/Transforms/InstCombine/udiv-simplify-bug-0.ll +++ b/test/Transforms/InstCombine/udiv-simplify-bug-0.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i64 0} | count 2 +; RUN: opt < %s -instcombine -S | grep {ret i64 0} | count 2 define i64 @foo(i32 %x) nounwind { %y = lshr i32 %x, 1 diff --git a/test/Transforms/InstCombine/udiv-simplify-bug-1.ll b/test/Transforms/InstCombine/udiv-simplify-bug-1.ll index 0036760ba50ee..d95e8f8359085 100644 --- a/test/Transforms/InstCombine/udiv-simplify-bug-1.ll +++ b/test/Transforms/InstCombine/udiv-simplify-bug-1.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis > %t1.ll +; RUN: opt < %s -instcombine -S > %t1.ll ; RUN: grep udiv %t1.ll | count 2 ; RUN: grep zext %t1.ll | count 2 ; PR2274 diff --git a/test/Transforms/InstCombine/udiv_select_to_select_shift.ll b/test/Transforms/InstCombine/udiv_select_to_select_shift.ll index 614ae3dc975c7..9b059a6cc94d9 100644 --- a/test/Transforms/InstCombine/udiv_select_to_select_shift.ll +++ b/test/Transforms/InstCombine/udiv_select_to_select_shift.ll @@ -1,7 +1,7 @@ ; Test that this transform works: ; udiv X, (Select Cond, C1, C2) --> Select Cond, (shr X, C1), (shr X, C2) ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis -f -o %t +; RUN: opt < %s -instcombine -S -o %t ; RUN: not grep select %t ; RUN: grep lshr %t | count 2 ; RUN: not grep udiv %t diff --git a/test/Transforms/InstCombine/udivrem-change-width.ll b/test/Transforms/InstCombine/udivrem-change-width.ll new file mode 100644 index 0000000000000..56877e30f9cf3 --- /dev/null +++ b/test/Transforms/InstCombine/udivrem-change-width.ll @@ -0,0 +1,19 @@ +; RUN: opt < %s -instcombine -S | not grep zext +; PR4548 + +define i8 @udiv_i8(i8 %a, i8 %b) nounwind { + %conv = zext i8 %a to i32 + %conv2 = zext i8 %b to i32 + %div = udiv i32 %conv, %conv2 + %conv3 = trunc i32 %div to i8 + ret i8 %conv3 +} + +define i8 @urem_i8(i8 %a, i8 %b) nounwind { + %conv = zext i8 %a to i32 + %conv2 = zext i8 %b to i32 + %div = urem i32 %conv, %conv2 + %conv3 = trunc i32 %div to i8 + ret i8 %conv3 +} + diff --git a/test/Transforms/InstCombine/urem-simplify-bug.ll b/test/Transforms/InstCombine/urem-simplify-bug.ll index 15956f26b69a0..7c2b4b01ca667 100644 --- a/test/Transforms/InstCombine/urem-simplify-bug.ll +++ b/test/Transforms/InstCombine/urem-simplify-bug.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {= or i32 %x, -5 } +; RUN: opt < %s -instcombine -S | grep {= or i32 %x, -5 } @.str = internal constant [5 x i8] c"foo\0A\00" ; <[5 x i8]*> [#uses=1] @.str1 = internal constant [5 x i8] c"bar\0A\00" ; <[5 x i8]*> [#uses=1] diff --git a/test/Transforms/InstCombine/urem.ll b/test/Transforms/InstCombine/urem.ll index 24e7463cbaf84..51084224a734a 100644 --- a/test/Transforms/InstCombine/urem.ll +++ b/test/Transforms/InstCombine/urem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep urem +; RUN: opt < %s -instcombine -S | grep urem define i64 @rem_unsigned(i64 %x1, i64 %y2) { %r = udiv i64 %x1, %y2 diff --git a/test/Transforms/InstCombine/vec_demanded_elts-2.ll b/test/Transforms/InstCombine/vec_demanded_elts-2.ll index dac03152fea13..41593612e55f1 100644 --- a/test/Transforms/InstCombine/vec_demanded_elts-2.ll +++ b/test/Transforms/InstCombine/vec_demanded_elts-2.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractelement +; RUN: opt < %s -instcombine -S | not grep extractelement define void @get_image() nounwind { entry: diff --git a/test/Transforms/InstCombine/vec_demanded_elts-3.ll b/test/Transforms/InstCombine/vec_demanded_elts-3.ll index eba3629eb9e70..62e43701d24e7 100644 --- a/test/Transforms/InstCombine/vec_demanded_elts-3.ll +++ b/test/Transforms/InstCombine/vec_demanded_elts-3.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load +; RUN: opt < %s -instcombine -S | not grep load ; PR4340 define void @vac(<4 x float>* nocapture %a) nounwind { diff --git a/test/Transforms/InstCombine/vec_demanded_elts.ll b/test/Transforms/InstCombine/vec_demanded_elts.ll index 95df8c63f6d48..2009a776b1511 100644 --- a/test/Transforms/InstCombine/vec_demanded_elts.ll +++ b/test/Transforms/InstCombine/vec_demanded_elts.ll @@ -1,12 +1,12 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {fadd float} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {fmul float} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {insertelement.*0.00} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {call.*llvm.x86.sse.mul} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {call.*llvm.x86.sse.sub} ; END. diff --git a/test/Transforms/InstCombine/vec_extract_elt.ll b/test/Transforms/InstCombine/vec_extract_elt.ll index 30b2f1d042b4c..63e4ee2112d81 100644 --- a/test/Transforms/InstCombine/vec_extract_elt.ll +++ b/test/Transforms/InstCombine/vec_extract_elt.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep extractelement +; RUN: opt < %s -instcombine -S | not grep extractelement define i32 @test(float %f) { %tmp7 = insertelement <4 x float> undef, float %f, i32 0 ; <<4 x float>> [#uses=1] diff --git a/test/Transforms/InstCombine/vec_insertelt.ll b/test/Transforms/InstCombine/vec_insertelt.ll index 9be154b987158..eedf882518bf3 100644 --- a/test/Transforms/InstCombine/vec_insertelt.ll +++ b/test/Transforms/InstCombine/vec_insertelt.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret <4 x i32> %A} +; RUN: opt < %s -instcombine -S | grep {ret <4 x i32> %A} ; PR1286 define <4 x i32> @test1(<4 x i32> %A) { diff --git a/test/Transforms/InstCombine/vec_narrow.ll b/test/Transforms/InstCombine/vec_narrow.ll index e444c2a65103c..daf7bcf297c1d 100644 --- a/test/Transforms/InstCombine/vec_narrow.ll +++ b/test/Transforms/InstCombine/vec_narrow.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {add float} %V = type <4 x float> diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index aaaee3f84315e..29adc1e208903 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -1,20 +1,25 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep vector_shuffle -; END. +; RUN: opt < %s -instcombine -S | FileCheck %s %T = type <4 x float> define %T @test1(%T %v1) { +; CHECK: @test1 +; CHECK: ret %T %v1 %v2 = shufflevector %T %v1, %T undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> ret %T %v2 } define %T @test2(%T %v1) { +; CHECK: @test2 +; CHECK: ret %T %v1 %v2 = shufflevector %T %v1, %T %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7> ret %T %v2 } define float @test3(%T %A, %T %B, float %f) { +; CHECK: @test3 +; CHECK: ret float %f %C = insertelement %T %A, float %f, i32 0 %D = shufflevector %T %C, %T %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7> %E = extractelement %T %D, i32 1 @@ -22,18 +27,27 @@ define float @test3(%T %A, %T %B, float %f) { } define i32 @test4(<4 x i32> %X) { +; CHECK: @test4 +; CHECK-NEXT: extractelement +; CHECK-NEXT: ret %tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> zeroinitializer %tmp34 = extractelement <4 x i32> %tmp152.i53899.i, i32 0 ret i32 %tmp34 } define i32 @test5(<4 x i32> %X) { +; CHECK: @test5 +; CHECK-NEXT: extractelement +; CHECK-NEXT: ret %tmp152.i53899.i = shufflevector <4 x i32> %X, <4 x i32> undef, <4 x i32> <i32 3, i32 2, i32 undef, i32 undef> %tmp34 = extractelement <4 x i32> %tmp152.i53899.i, i32 0 ret i32 %tmp34 } define float @test6(<4 x float> %X) { +; CHECK: @test6 +; CHECK-NEXT: extractelement +; CHECK-NEXT: ret %X1 = bitcast <4 x float> %X to <4 x i32> %tmp152.i53899.i = shufflevector <4 x i32> %X1, <4 x i32> undef, <4 x i32> zeroinitializer %tmp152.i53900.i = bitcast <4 x i32> %tmp152.i53899.i to <4 x float> @@ -42,6 +56,34 @@ define float @test6(<4 x float> %X) { } define <4 x float> @test7(<4 x float> %tmp45.i) { +; CHECK: @test7 +; CHECK-NEXT: ret %T %tmp45.i %tmp1642.i = shufflevector <4 x float> %tmp45.i, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 6, i32 7 > ret <4 x float> %tmp1642.i } + +; This should turn into a single shuffle. +define <4 x float> @test8(<4 x float> %tmp, <4 x float> %tmp1) { +; CHECK: @test8 +; CHECK-NEXT: shufflevector +; CHECK-NEXT: ret + %tmp4 = extractelement <4 x float> %tmp, i32 1 + %tmp2 = extractelement <4 x float> %tmp, i32 3 + %tmp1.upgrd.1 = extractelement <4 x float> %tmp1, i32 0 + %tmp128 = insertelement <4 x float> undef, float %tmp4, i32 0 + %tmp130 = insertelement <4 x float> %tmp128, float undef, i32 1 + %tmp132 = insertelement <4 x float> %tmp130, float %tmp2, i32 2 + %tmp134 = insertelement <4 x float> %tmp132, float %tmp1.upgrd.1, i32 3 + ret <4 x float> %tmp134 +} + +; Test fold of two shuffles where the first shuffle vectors inputs are a +; different length then the second. +define <4 x i8> @test9(<16 x i8> %tmp6) nounwind { +; CHECK: @test9 +; CHECK-NEXT: shufflevector +; CHECK-NEXT: ret + %tmp7 = shufflevector <16 x i8> %tmp6, <16 x i8> undef, <4 x i32> < i32 13, i32 9, i32 4, i32 13 > ; <<4 x i8>> [#uses=1] + %tmp9 = shufflevector <4 x i8> %tmp7, <4 x i8> undef, <4 x i32> < i32 3, i32 1, i32 2, i32 0 > ; <<4 x i8>> [#uses=1] + ret <4 x i8> %tmp9 +}
\ No newline at end of file diff --git a/test/Transforms/InstCombine/vector-casts.ll b/test/Transforms/InstCombine/vector-casts.ll new file mode 100644 index 0000000000000..470d48547532f --- /dev/null +++ b/test/Transforms/InstCombine/vector-casts.ll @@ -0,0 +1,107 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; This turns into a&1 != 0 +define <2 x i1> @test1(<2 x i64> %a) { + %t = trunc <2 x i64> %a to <2 x i1> + ret <2 x i1> %t + +; CHECK: @test1 +; CHECK: and <2 x i64> %a, <i64 1, i64 1> +; CHECK: icmp ne <2 x i64> %tmp, zeroinitializer +} + +; The ashr turns into an lshr. +define <2 x i64> @test2(<2 x i64> %a) { + %b = and <2 x i64> %a, <i64 65535, i64 65535> + %t = ashr <2 x i64> %b, <i64 1, i64 1> + ret <2 x i64> %t + +; CHECK: @test2 +; CHECK: and <2 x i64> %a, <i64 65535, i64 65535> +; CHECK: lshr <2 x i64> %b, <i64 1, i64 1> +} + + + +define <2 x i64> @test3(<4 x float> %a, <4 x float> %b) nounwind readnone { +entry: + %cmp = fcmp ord <4 x float> %a, zeroinitializer + %sext = sext <4 x i1> %cmp to <4 x i32> + %cmp4 = fcmp ord <4 x float> %b, zeroinitializer + %sext5 = sext <4 x i1> %cmp4 to <4 x i32> + %and = and <4 x i32> %sext, %sext5 + %conv = bitcast <4 x i32> %and to <2 x i64> + ret <2 x i64> %conv + +; CHECK: @test3 +; CHECK: fcmp ord <4 x float> %a, %b +} + +define <2 x i64> @test4(<4 x float> %a, <4 x float> %b) nounwind readnone { +entry: + %cmp = fcmp uno <4 x float> %a, zeroinitializer + %sext = sext <4 x i1> %cmp to <4 x i32> + %cmp4 = fcmp uno <4 x float> %b, zeroinitializer + %sext5 = sext <4 x i1> %cmp4 to <4 x i32> + %or = or <4 x i32> %sext, %sext5 + %conv = bitcast <4 x i32> %or to <2 x i64> + ret <2 x i64> %conv +; CHECK: @test4 +; CHECK: fcmp uno <4 x float> %a, %b +} + + + +define void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind { +entry: + %val = trunc <2 x i64> %src to <2 x i32> + %add = add <2 x i32> %val, <i32 1, i32 1> + store <2 x i32> %add, <2 x i32>* %dst.addr + ret void +} + +define <2 x i65> @foo(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = zext <2 x i32> %a to <2 x i65> + ret <2 x i65> %b +} +define <2 x i64> @bar(<2 x i65> %t) { + %a = trunc <2 x i65> %t to <2 x i32> + %b = zext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i65> @foos(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i65> + ret <2 x i65> %b +} +define <2 x i64> @bars(<2 x i65> %t) { + %a = trunc <2 x i65> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i64> @quxs(<2 x i64> %t) { + %a = trunc <2 x i64> %t to <2 x i32> + %b = sext <2 x i32> %a to <2 x i64> + ret <2 x i64> %b +} +define <2 x i64> @quxt(<2 x i64> %t) { + %a = shl <2 x i64> %t, <i64 32, i64 32> + %b = ashr <2 x i64> %a, <i64 32, i64 32> + ret <2 x i64> %b +} +define <2 x double> @fa(<2 x double> %t) { + %a = fptrunc <2 x double> %t to <2 x float> + %b = fpext <2 x float> %a to <2 x double> + ret <2 x double> %b +} +define <2 x double> @fb(<2 x double> %t) { + %a = fptoui <2 x double> %t to <2 x i64> + %b = uitofp <2 x i64> %a to <2 x double> + ret <2 x double> %b +} +define <2 x double> @fc(<2 x double> %t) { + %a = fptosi <2 x double> %t to <2 x i64> + %b = sitofp <2 x i64> %a to <2 x double> + ret <2 x double> %b +} diff --git a/test/Transforms/InstCombine/vector-srem.ll b/test/Transforms/InstCombine/vector-srem.ll index e8766ebc1e077..acb11c52adb39 100644 --- a/test/Transforms/InstCombine/vector-srem.ll +++ b/test/Transforms/InstCombine/vector-srem.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {srem <4 x i32>} +; RUN: opt < %s -instcombine -S | grep {srem <4 x i32>} define <4 x i32> @foo(<4 x i32> %t, <4 x i32> %u) { diff --git a/test/Transforms/InstCombine/volatile_store.ll b/test/Transforms/InstCombine/volatile_store.ll index 09651ba302d54..5316bd772e13a 100644 --- a/test/Transforms/InstCombine/volatile_store.ll +++ b/test/Transforms/InstCombine/volatile_store.ll @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile store} -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {volatile load} +; RUN: opt < %s -instcombine -S | grep {volatile store} +; RUN: opt < %s -instcombine -S | grep {volatile load} @x = weak global i32 0 ; <i32*> [#uses=2] diff --git a/test/Transforms/InstCombine/xor-demorgans.ll b/test/Transforms/InstCombine/xor-demorgans.ll index c8de6dbdf21bd..3383845fb3611 100644 --- a/test/Transforms/InstCombine/xor-demorgans.ll +++ b/test/Transforms/InstCombine/xor-demorgans.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {= or} +; RUN: opt < %s -instcombine -S | not grep {= or} ; PR3266 ; XFAIL: * diff --git a/test/Transforms/InstCombine/xor-undef.ll b/test/Transforms/InstCombine/xor-undef.ll index c090223b53714..cf72955b66b31 100644 --- a/test/Transforms/InstCombine/xor-undef.ll +++ b/test/Transforms/InstCombine/xor-undef.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep zeroinitializer +; RUN: opt < %s -instcombine -S | grep zeroinitializer define <2 x i64> @f() { %tmp = xor <2 x i64> undef, undef diff --git a/test/Transforms/InstCombine/xor.ll b/test/Transforms/InstCombine/xor.ll index d8b84a6122ddb..a7bcdac08bd89 100644 --- a/test/Transforms/InstCombine/xor.ll +++ b/test/Transforms/InstCombine/xor.ll @@ -1,6 +1,6 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: not grep {xor } ; END. @G1 = global i32 0 ; <i32*> [#uses=1] diff --git a/test/Transforms/InstCombine/xor2.ll b/test/Transforms/InstCombine/xor2.ll index efb3146c68bfc..23a9915813765 100644 --- a/test/Transforms/InstCombine/xor2.ll +++ b/test/Transforms/InstCombine/xor2.ll @@ -1,17 +1,43 @@ ; This test makes sure that these instructions are properly eliminated. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {xor } +; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1253 define i1 @test0(i32 %A) { +; CHECK: @test0 +; CHECK: %C = icmp slt i32 %A, 0 %B = xor i32 %A, -2147483648 %C = icmp sgt i32 %B, -1 ret i1 %C } define i1 @test1(i32 %A) { +; CHECK: @test1 +; CHECK: %C = icmp slt i32 %A, 0 %B = xor i32 %A, 12345 %C = icmp slt i32 %B, 0 ret i1 %C } +; PR1014 +define i32 @test2(i32 %tmp1) { +; CHECK: @test2 +; CHECK-NEXT: or i32 %tmp1, 8 +; CHECK-NEXT: and i32 +; CHECK-NEXT: ret i32 + %ovm = and i32 %tmp1, 32 + %ov3 = add i32 %ovm, 145 + %ov110 = xor i32 %ov3, 153 + ret i32 %ov110 +} + +define i32 @test3(i32 %tmp1) { +; CHECK: @test3 +; CHECK-NEXT: or i32 %tmp1, 8 +; CHECK-NEXT: and i32 +; CHECK-NEXT: ret i32 + %ovm = or i32 %tmp1, 145 + %ov31 = and i32 %ovm, 177 + %ov110 = xor i32 %ov31, 153 + ret i32 %ov110 +} diff --git a/test/Transforms/InstCombine/zero-point-zero-add.ll b/test/Transforms/InstCombine/zero-point-zero-add.ll index adb28e4d5c7fc..d07a9f4b9de06 100644 --- a/test/Transforms/InstCombine/zero-point-zero-add.ll +++ b/test/Transforms/InstCombine/zero-point-zero-add.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 0.0 | count 1 +; RUN: opt < %s -instcombine -S | grep 0.0 | count 1 declare double @abs(double) diff --git a/test/Transforms/InstCombine/zeroext-and-reduce.ll b/test/Transforms/InstCombine/zeroext-and-reduce.ll index 2b4950aec9781..592b8a172f8e1 100644 --- a/test/Transforms/InstCombine/zeroext-and-reduce.ll +++ b/test/Transforms/InstCombine/zeroext-and-reduce.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ +; RUN: opt < %s -instcombine -S | \ ; RUN: grep {and i32 %Y, 8} define i32 @test1(i8 %X) { diff --git a/test/Transforms/InstCombine/zext-bool-add-sub.ll b/test/Transforms/InstCombine/zext-bool-add-sub.ll new file mode 100644 index 0000000000000..11642733acc07 --- /dev/null +++ b/test/Transforms/InstCombine/zext-bool-add-sub.ll @@ -0,0 +1,29 @@ +; RUN: opt < %s -instcombine -S | not grep zext + +define i32 @a(i1 %x) { +entry: + %y = zext i1 %x to i32 + %res = add i32 %y, 1 + ret i32 %res +} + +define i32 @b(i1 %x) { +entry: + %y = zext i1 %x to i32 + %res = add i32 %y, -1 + ret i32 %res +} + +define i32 @c(i1 %x) { +entry: + %y = zext i1 %x to i32 + %res = sub i32 0, %y + ret i32 %res +} + +define i32 @d(i1 %x) { +entry: + %y = zext i1 %x to i32 + %res = sub i32 3, %y + ret i32 %res +} diff --git a/test/Transforms/InstCombine/zext-fold.ll b/test/Transforms/InstCombine/zext-fold.ll index 27ea46061b073..9521101e736a9 100644 --- a/test/Transforms/InstCombine/zext-fold.ll +++ b/test/Transforms/InstCombine/zext-fold.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {zext } | count 1 +; RUN: opt < %s -instcombine -S | grep {zext } | count 1 ; PR1570 define i32 @test2(float %X, float %Y) { diff --git a/test/Transforms/InstCombine/zext-or-icmp.ll b/test/Transforms/InstCombine/zext-or-icmp.ll index 35c7c0a6be6ed..969c301570316 100644 --- a/test/Transforms/InstCombine/zext-or-icmp.ll +++ b/test/Transforms/InstCombine/zext-or-icmp.ll @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp | count 1 +; RUN: opt < %s -instcombine -S | grep icmp | count 1 %struct.FooBar = type <{ i8, i8, [2 x i8], i8, i8, i8, i8, i16, i16, [4 x i8], [8 x %struct.Rock] }> %struct.Rock = type { i16, i16 } diff --git a/test/Transforms/InstCombine/zext.ll b/test/Transforms/InstCombine/zext.ll index c0fa3771cc15d..10eabf7aed46a 100644 --- a/test/Transforms/InstCombine/zext.ll +++ b/test/Transforms/InstCombine/zext.ll @@ -1,33 +1,11 @@ ; Tests to make sure elimination of casts is working correctly -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: notcast {} {%c1.*} +; RUN: opt < %s -instcombine -S | FileCheck %s define i64 @test_sext_zext(i16 %A) { %c1 = zext i16 %A to i32 ; <i32> [#uses=1] %c2 = sext i32 %c1 to i64 ; <i64> [#uses=1] ret i64 %c2 +; CHECK-NOT: %c1 +; CHECK: %c2 = zext i16 %A to i64 +; CHECK: ret i64 %c2 } - -; PR3599 -define i32 @test2(i64 %tmp) nounwind readnone { -entry: - %tmp5 = trunc i64 %tmp to i8 ; <i8> [#uses=1] - %tmp7 = lshr i64 %tmp, 8 ; <i64> [#uses=1] - %tmp8 = trunc i64 %tmp7 to i8 ; <i8> [#uses=1] - %tmp10 = lshr i64 %tmp, 16 ; <i64> [#uses=1] - %tmp11 = trunc i64 %tmp10 to i8 ; <i8> [#uses=1] - %tmp13 = lshr i64 %tmp, 24 ; <i64> [#uses=1] - %tmp14 = trunc i64 %tmp13 to i8 ; <i8> [#uses=1] - %tmp1 = zext i8 %tmp5 to i32 ; <i32> [#uses=1] - %tmp2 = zext i8 %tmp8 to i32 ; <i32> [#uses=1] - %tmp3 = shl i32 %tmp2, 8 ; <i32> [#uses=1] - %tmp4 = zext i8 %tmp11 to i32 ; <i32> [#uses=1] - %tmp6 = shl i32 %tmp4, 16 ; <i32> [#uses=1] - %tmp9 = zext i8 %tmp14 to i32 ; <i32> [#uses=1] - %tmp12 = shl i32 %tmp9, 24 ; <i32> [#uses=1] - %tmp15 = or i32 %tmp12, %tmp1 ; <i32> [#uses=1] - %tmp16 = or i32 %tmp15, %tmp6 ; <i32> [#uses=1] - %tmp17 = or i32 %tmp16, %tmp3 ; <i32> [#uses=1] - ret i32 %tmp17 -} - |