summaryrefslogtreecommitdiffstats
path: root/test/Transforms/IndVarSimplify
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/IndVarSimplify')
-rw-r--r--test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll4
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-15-Crash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2005-11-18-Crash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll4
-rw-r--r--test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2008-09-02-IVType.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-03-Floating.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-17-Floating.ll6
-rw-r--r--test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2009-04-27-Floating.ll2
-rw-r--r--test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll2
-rw-r--r--test/Transforms/IndVarSimplify/ada-loops.ll2
-rw-r--r--test/Transforms/IndVarSimplify/addrec-gep.ll2
-rw-r--r--test/Transforms/IndVarSimplify/ashr-tripcount.ll2
-rw-r--r--test/Transforms/IndVarSimplify/avoid-i0.ll2
-rw-r--r--test/Transforms/IndVarSimplify/casted-argument.ll2
-rw-r--r--test/Transforms/IndVarSimplify/complex-scev.ll2
-rw-r--r--test/Transforms/IndVarSimplify/divide-pointer.ll2
-rw-r--r--test/Transforms/IndVarSimplify/exit_value_tests.ll2
-rw-r--r--test/Transforms/IndVarSimplify/gep-with-mul-base.ll2
-rw-r--r--test/Transforms/IndVarSimplify/interesting-invoke-use.ll2
-rw-r--r--test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll2
-rw-r--r--test/Transforms/IndVarSimplify/iv-sext.ll143
-rw-r--r--test/Transforms/IndVarSimplify/iv-zext.ll2
-rw-r--r--test/Transforms/IndVarSimplify/lftr-other-uses.ll2
-rw-r--r--test/Transforms/IndVarSimplify/lftr-promote.ll38
-rw-r--r--test/Transforms/IndVarSimplify/lftr_simple.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop-invariant-step.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate10.ll47
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate11.ll36
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate7.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate8.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate9.ll6
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_1.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_2.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_3.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_4.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_5.ll2
-rw-r--r--test/Transforms/IndVarSimplify/loop_evaluate_6.ll2
-rw-r--r--test/Transforms/IndVarSimplify/masked-iv.ll2
-rw-r--r--test/Transforms/IndVarSimplify/max-pointer.ll39
-rw-r--r--test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll2
-rw-r--r--test/Transforms/IndVarSimplify/pointer-indvars.ll2
-rw-r--r--test/Transforms/IndVarSimplify/pointer.ll2
-rw-r--r--test/Transforms/IndVarSimplify/polynomial-expand.ll38
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll41
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep-nested.ll75
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep-remainder.ll2
-rw-r--r--test/Transforms/IndVarSimplify/preserve-gep.ll2
-rw-r--r--test/Transforms/IndVarSimplify/preserve-signed-wrap.ll2
-rw-r--r--test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll2
-rw-r--r--test/Transforms/IndVarSimplify/shrunk-constant.ll2
-rw-r--r--test/Transforms/IndVarSimplify/signed-trip-count.ll2
-rw-r--r--test/Transforms/IndVarSimplify/single-element-range.ll27
-rw-r--r--test/Transforms/IndVarSimplify/sink-alloca.ll31
-rw-r--r--test/Transforms/IndVarSimplify/sink-trapping.ll19
-rw-r--r--test/Transforms/IndVarSimplify/subtract.ll2
-rw-r--r--test/Transforms/IndVarSimplify/tripcount_compute.ll2
-rw-r--r--test/Transforms/IndVarSimplify/tripcount_infinite.ll2
-rw-r--r--test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll2
-rw-r--r--test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll2
85 files changed, 615 insertions, 79 deletions
diff --git a/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll b/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll
index 228772e..92911ae 100644
--- a/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll
+++ b/test/Transforms/IndVarSimplify/2002-09-09-PointerIndVar.ll
@@ -1,7 +1,7 @@
; Induction variable pass is doing bad things with pointer induction vars,
; trying to do arithmetic on them directly.
;
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
;
define void @test(i32 %A, i32 %S, i8* %S.upgrd.1) {
; <label>:0
diff --git a/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll b/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll
index 2487ea9..38fa112 100644
--- a/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll
+++ b/test/Transforms/IndVarSimplify/2003-04-16-ExprAnalysis.ll
@@ -1,7 +1,7 @@
; This is a test case for the expression analysis code, not really indvars.
; It was assuming any constant of int type was a ConstantInteger.
;
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
@X = global i32 7 ; <i32*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll b/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll
index 9619099..36d5006 100644
--- a/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll
+++ b/test/Transforms/IndVarSimplify/2003-09-12-MultiplePred.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+; RUN: opt < %s -indvars -S | grep indvar
define i32 @test() {
; <label>:0
diff --git a/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll b/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll
index b4a2c50..150ae70 100644
--- a/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll
+++ b/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | %prcontext ^Loop: 1 | grep %Canonical
+; RUN: opt -S -indvars %s | FileCheck %s
; The indvar simplification code should ensure that the first PHI in the block
; is the canonical one!
@@ -8,6 +8,8 @@ define i32 @test() {
br label %Loop
Loop: ; preds = %Loop, %0
+; CHECK: Loop:
+; CHECK-NEXT: Canonical
%NonIndvar = phi i32 [ 200, %0 ], [ %NonIndvarNext, %Loop ] ; <i32> [#uses=1]
%Canonical = phi i32 [ 0, %0 ], [ %CanonicalNext, %Loop ] ; <i32> [#uses=2]
store i32 %Canonical, i32* null
diff --git a/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll b/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
index bd9d1ef..c8f97e3 100644
--- a/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
+++ b/test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll
@@ -1,7 +1,7 @@
; The induction variable canonicalization pass shouldn't leave dead
; instructions laying around!
;
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: opt < %s -indvars -S | \
; RUN: not grep {#uses=0}
define i32 @mul(i32 %x, i32 %y) {
diff --git a/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll b/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
index 11af997..70ea11e 100644
--- a/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
+++ b/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @test() {
entry:
diff --git a/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll b/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
index b964d78..5aa2d90 100644
--- a/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
+++ b/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @_ZN17CoinFactorization7cleanupEv() {
entry:
br i1 false, label %loopexit.14, label %cond_continue.3
diff --git a/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll b/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll
index cf8c8047..0fc9c85 100644
--- a/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll
+++ b/test/Transforms/IndVarSimplify/2003-12-21-IndVarSize.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar | not grep i32
+; RUN: opt < %s -indvars -S | grep indvar | not grep i32
@G = global i64 0 ; <i64*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll b/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll
index 248b29b..c49819e 100644
--- a/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll
+++ b/test/Transforms/IndVarSimplify/2004-03-10-PHIInsertionBug.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @test() {
br label %endif.0.i
diff --git a/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
index 54d8547..1ed4c44 100644
--- a/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
+++ b/test/Transforms/IndVarSimplify/2004-04-05-InvokeCastCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; ModuleID = '2004-04-05-InvokeCastCrash.ll'
%struct.__false_type = type { i8 }
%"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>" = type { %"struct.__gnu_cxx::_Hashtable_node<const llvm::Constant*>"*, %"struct.llvm::Constant"* }
diff --git a/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll b/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll
index b4eb3db..ec1218b 100644
--- a/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll
+++ b/test/Transforms/IndVarSimplify/2004-04-07-ScalarEvolutionCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @.outPlank_21() {
entry:
diff --git a/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll
index afee7e1..aee67cc 100644
--- a/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll
+++ b/test/Transforms/IndVarSimplify/2005-02-11-InvokeCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @_ZN5ArrayISt7complexIdEEC2ERK10dim_vector() {
entry:
diff --git a/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll
index a1beec6..70a7a9d 100644
--- a/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll
+++ b/test/Transforms/IndVarSimplify/2005-02-17-TruncateExprCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
declare void @q_atomic_increment()
diff --git a/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
index 853d5ad..1ba6982 100644
--- a/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
+++ b/test/Transforms/IndVarSimplify/2005-02-26-ExitValueCompute.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: opt < %s -indvars -S | \
; RUN: grep {ret i32 152}
define i32 @main() {
diff --git a/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll b/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
index ba4db9f..0862f11 100644
--- a/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
+++ b/test/Transforms/IndVarSimplify/2005-06-15-InstMoveCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @main() {
entry:
diff --git a/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll b/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
index 5ee8cea..f9a3fe6 100644
--- a/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
+++ b/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
@fixtab = external global [29 x [29 x [2 x i32]]] ; <[29 x [29 x [2 x i32]]]*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
index 32abee9..1bbc631 100644
--- a/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
+++ b/test/Transforms/IndVarSimplify/2006-03-31-NegativeStride.ll
@@ -1,5 +1,5 @@
; PR726
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | \
+; RUN: opt < %s -indvars -S | \
; RUN: grep {ret i32 27}
; Make sure to compute the right exit value based on negative strides.
diff --git a/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll b/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll
index 986831b..36ec2b8 100644
--- a/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll
+++ b/test/Transforms/IndVarSimplify/2006-06-16-Indvar-LCSSA-Crash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
define void @get_block() {
endif.0:
diff --git a/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll b/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll
index 6a478ab..787c9b0 100644
--- a/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll
+++ b/test/Transforms/IndVarSimplify/2006-09-20-LFTR-Crash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; ModuleID = '2006-09-20-LFTR-Crash.ll'
%struct.p7prior_s = type { i32, i32, [200 x float], [200 x [7 x float]], i32, [200 x float], [200 x [20 x float]], i32, [200 x float], [200 x [20 x float]] }
diff --git a/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll b/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
index b2f8258..79ac1f0 100644
--- a/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
+++ b/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
target datalayout = "e-p:32:32"
target triple = "i686-apple-darwin8"
%struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
diff --git a/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
index dd151e8..268b8d1 100644
--- a/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
+++ b/test/Transforms/IndVarSimplify/2007-01-06-TripCount.ll
@@ -1,5 +1,5 @@
; PR1015
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep {ret i32 0}
+; RUN: opt < %s -indvars -S | not grep {ret i32 0}
target datalayout = "e-p:32:32"
target triple = "i686-apple-darwin8"
diff --git a/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll b/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll
index 7078494..de226a1 100644
--- a/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll
+++ b/test/Transforms/IndVarSimplify/2007-01-08-X86-64-Pointer.ll
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | llc -march=x86-64 | grep {(%rdi,%rax,8)}
-; RUN: llvm-as < %s | llc -march=x86-64 | not grep {addq.*8}
+; RUN: llc %s -o - -march=x86-64 | grep {(%rdi,%rax,8)}
+; RUN: llc %s -o - -march=x86-64 | not grep {addq.*8}
define void @foo(double* %y) nounwind {
entry:
diff --git a/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll b/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
index 363c98c..fc7d633 100644
--- a/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
+++ b/test/Transforms/IndVarSimplify/2007-06-06-DeleteDanglesPtr.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; PR1487
%struct.AVClass = type { i8*, i8* (i8*)*, %struct.AVOption* }
diff --git a/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll b/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll
index 555cadd..cad4eb1 100644
--- a/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll
+++ b/test/Transforms/IndVarSimplify/2007-11-23-BitcastCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; PR1814
target datalayout = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32"
diff --git a/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll b/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll
index aac8d97..77235d2 100644
--- a/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll
+++ b/test/Transforms/IndVarSimplify/2008-06-15-SCEVExpanderBug.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; PR2434
define fastcc void @regcppop() nounwind {
diff --git a/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
index 8111cbe..288431a 100644
--- a/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
+++ b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep sext | count 1
+; RUN: opt < %s -indvars -S | grep sext | count 1
; ModuleID = '<stdin>'
%struct.App1Marker = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>
diff --git a/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll b/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
index c78188d..23e7884 100644
--- a/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
+++ b/test/Transforms/IndVarSimplify/2008-10-03-CouldNotCompute.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR2857
@foo = external global i32 ; <i32*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll b/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll
index be8b36f..7b4032b 100644
--- a/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll
+++ b/test/Transforms/IndVarSimplify/2008-11-03-Floating.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | count 4
+; RUN: opt < %s -indvars -S | grep icmp | count 4
define void @bar() nounwind {
entry:
br label %bb
diff --git a/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll b/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll
index c947d3b..311d3da 100644
--- a/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll
+++ b/test/Transforms/IndVarSimplify/2008-11-17-Floating.ll
@@ -1,6 +1,6 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | count 2
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep sitofp | count 1
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep uitofp | count 1
+; RUN: opt < %s -indvars -S | grep icmp | count 2
+; RUN: opt < %s -indvars -S | grep sitofp | count 1
+; RUN: opt < %s -indvars -S | grep uitofp | count 1
define void @bar() nounwind {
entry:
diff --git a/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll b/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll
index e611b1f..39b97af 100644
--- a/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll
+++ b/test/Transforms/IndVarSimplify/2008-11-25-APFloatAssert.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
define void @t() nounwind {
entry:
diff --git a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
index 134c9c7..37ad63a 100644
--- a/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
+++ b/test/Transforms/IndVarSimplify/2009-04-14-shorten_iv_vars.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep {sext}
+; RUN: opt < %s -indvars -S | not grep {sext}
; ModuleID = '<stdin>'
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-darwin9.6"
diff --git a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll
index 4d26803..803b540 100644
--- a/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll
+++ b/test/Transforms/IndVarSimplify/2009-04-15-shorten-iv-vars-2.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -instcombine | llvm-dis | not grep {\[sz\]ext}
+; RUN: opt < %s -indvars -instcombine -S | not grep {\[sz\]ext}
; ModuleID = '<stdin>'
;extern int *a, *b, *c, *d, *e, *f; /* 64 bit */
;extern int K[256];
diff --git a/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll b/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll
index f39458f..24074bf 100644
--- a/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll
+++ b/test/Transforms/IndVarSimplify/2009-04-22-IndvarCrash.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; rdar://6817574
define i32 @t1() nounwind ssp {
diff --git a/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll b/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll
index e70d577..9fd2d2f 100644
--- a/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll
+++ b/test/Transforms/IndVarSimplify/2009-04-27-Floating.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep icmp | grep next
+; RUN: opt < %s -indvars -S | grep icmp | grep next
; PR4086
declare void @foo()
diff --git a/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
index ecbb231..9ad8691 100644
--- a/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
+++ b/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR4258
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-linux-gnu"
diff --git a/test/Transforms/IndVarSimplify/ada-loops.ll b/test/Transforms/IndVarSimplify/ada-loops.ll
index 56325b3..436840a 100644
--- a/test/Transforms/IndVarSimplify/ada-loops.ll
+++ b/test/Transforms/IndVarSimplify/ada-loops.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep phi %t | count 4
; RUN: grep {= phi i32} %t | count 4
; RUN: not grep {sext i} %t
diff --git a/test/Transforms/IndVarSimplify/addrec-gep.ll b/test/Transforms/IndVarSimplify/addrec-gep.ll
index 132d4f8..9e42734 100644
--- a/test/Transforms/IndVarSimplify/addrec-gep.ll
+++ b/test/Transforms/IndVarSimplify/addrec-gep.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep getelementptr %t | count 1
; RUN: grep {mul .*, 37} %t | count 1
; RUN: grep {add .*, 5203} %t | count 1
diff --git a/test/Transforms/IndVarSimplify/ashr-tripcount.ll b/test/Transforms/IndVarSimplify/ashr-tripcount.ll
index 7b2cad2..baaefdc 100644
--- a/test/Transforms/IndVarSimplify/ashr-tripcount.ll
+++ b/test/Transforms/IndVarSimplify/ashr-tripcount.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep sext %t | count 1
; Indvars should be able to eliminate all of the sign extensions
diff --git a/test/Transforms/IndVarSimplify/avoid-i0.ll b/test/Transforms/IndVarSimplify/avoid-i0.ll
index 3456bd3..d110a8a 100644
--- a/test/Transforms/IndVarSimplify/avoid-i0.ll
+++ b/test/Transforms/IndVarSimplify/avoid-i0.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR4052
; PR4054
diff --git a/test/Transforms/IndVarSimplify/casted-argument.ll b/test/Transforms/IndVarSimplify/casted-argument.ll
index 6d7aaa9..dfefe1d 100644
--- a/test/Transforms/IndVarSimplify/casted-argument.ll
+++ b/test/Transforms/IndVarSimplify/casted-argument.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; PR4009
; PR4038
diff --git a/test/Transforms/IndVarSimplify/complex-scev.ll b/test/Transforms/IndVarSimplify/complex-scev.ll
index 4bfc4e9..434c4ec 100644
--- a/test/Transforms/IndVarSimplify/complex-scev.ll
+++ b/test/Transforms/IndVarSimplify/complex-scev.ll
@@ -1,7 +1,7 @@
; The i induction variable looks like a wrap-around, but it really is just
; a simple affine IV. Make sure that indvars eliminates it.
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep phi | count 1
+; RUN: opt < %s -indvars -S | grep phi | count 1
define void @foo() {
entry:
diff --git a/test/Transforms/IndVarSimplify/divide-pointer.ll b/test/Transforms/IndVarSimplify/divide-pointer.ll
index 747d47e..16608ee 100644
--- a/test/Transforms/IndVarSimplify/divide-pointer.ll
+++ b/test/Transforms/IndVarSimplify/divide-pointer.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR4271
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/IndVarSimplify/exit_value_tests.ll b/test/Transforms/IndVarSimplify/exit_value_tests.ll
index b39f40f..737e733 100644
--- a/test/Transforms/IndVarSimplify/exit_value_tests.ll
+++ b/test/Transforms/IndVarSimplify/exit_value_tests.ll
@@ -2,7 +2,7 @@
; these loops all have predictable exit values we can replace the use outside
; of the loop with a closed-form computation, making the loop dead.
;
-; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | \
+; RUN: opt < %s -indvars -loop-deletion -simplifycfg | \
; RUN: llvm-dis | not grep br
define i32 @polynomial_constant() {
diff --git a/test/Transforms/IndVarSimplify/gep-with-mul-base.ll b/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
index e63c88c..7809594 100644
--- a/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
+++ b/test/Transforms/IndVarSimplify/gep-with-mul-base.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep add %t | count 8
; RUN: grep mul %t | count 7
diff --git a/test/Transforms/IndVarSimplify/interesting-invoke-use.ll b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll
index b90d1e0..8adc0e5 100644
--- a/test/Transforms/IndVarSimplify/interesting-invoke-use.ll
+++ b/test/Transforms/IndVarSimplify/interesting-invoke-use.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; An invoke has a result value which is used in an "Interesting"
; expression inside the loop. IndVars should be able to rewrite
diff --git a/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll b/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll
index 747c781..02145d1 100644
--- a/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll
+++ b/test/Transforms/IndVarSimplify/iterationCount_zext_or_trunc.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; ModuleID = 'testcase.bc'
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/IndVarSimplify/iv-sext.ll b/test/Transforms/IndVarSimplify/iv-sext.ll
new file mode 100644
index 0000000..5516502
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/iv-sext.ll
@@ -0,0 +1,143 @@
+; RUN: opt < %s -indvars -S > %t
+; RUN: grep {= sext} %t | count 4
+; RUN: grep {phi i64} %t | count 2
+
+; Indvars should be able to promote the hiPart induction variable in the
+; inner loop to i64.
+; TODO: it should promote hiPart to i64 in the outer loop too.
+
+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"
+
+define void @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bandEdgeIndex, float %tmp1) nounwind {
+entry:
+ %tmp = load float* %peakWeight, align 4 ; <float> [#uses=1]
+ %tmp2 = icmp sgt i32 %bandEdgeIndex, 0 ; <i1> [#uses=1]
+ br i1 %tmp2, label %bb.nph22, label %return
+
+bb.nph22: ; preds = %entry
+ %tmp3 = add i32 %bandEdgeIndex, -1 ; <i32> [#uses=2]
+ br label %bb
+
+bb: ; preds = %bb8, %bb.nph22
+ %distERBhi.121 = phi float [ %distERBhi.2.lcssa, %bb8 ], [ 0.000000e+00, %bb.nph22 ] ; <float> [#uses=2]
+ %distERBlo.120 = phi float [ %distERBlo.0.lcssa, %bb8 ], [ 0.000000e+00, %bb.nph22 ] ; <float> [#uses=2]
+ %hiPart.119 = phi i32 [ %hiPart.0.lcssa, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=3]
+ %loPart.118 = phi i32 [ %loPart.0.lcssa, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=2]
+ %peakCount.117 = phi float [ %peakCount.2.lcssa, %bb8 ], [ %tmp, %bb.nph22 ] ; <float> [#uses=2]
+ %part.016 = phi i32 [ %tmp46, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=5]
+ %tmp4 = icmp sgt i32 %part.016, 0 ; <i1> [#uses=1]
+ br i1 %tmp4, label %bb1, label %bb3.preheader
+
+bb1: ; preds = %bb
+ %tmp5 = add i32 %part.016, -1 ; <i32> [#uses=1]
+ %tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1]
+ %tmp7 = getelementptr float* %pTmp1, i64 %tmp6 ; <float*> [#uses=1]
+ %tmp8 = load float* %tmp7, align 4 ; <float> [#uses=1]
+ %tmp9 = fadd float %tmp8, %distERBlo.120 ; <float> [#uses=1]
+ %tmp10 = add i32 %part.016, -1 ; <i32> [#uses=1]
+ %tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1]
+ %tmp12 = getelementptr float* %pTmp1, i64 %tmp11 ; <float*> [#uses=1]
+ %tmp13 = load float* %tmp12, align 4 ; <float> [#uses=1]
+ %tmp14 = fsub float %distERBhi.121, %tmp13 ; <float> [#uses=1]
+ br label %bb3.preheader
+
+bb3.preheader: ; preds = %bb1, %bb
+ %distERBlo.0.ph = phi float [ %distERBlo.120, %bb ], [ %tmp9, %bb1 ] ; <float> [#uses=3]
+ %distERBhi.0.ph = phi float [ %distERBhi.121, %bb ], [ %tmp14, %bb1 ] ; <float> [#uses=3]
+ %tmp15 = fcmp ogt float %distERBlo.0.ph, 2.500000e+00 ; <i1> [#uses=1]
+ br i1 %tmp15, label %bb.nph, label %bb5.preheader
+
+bb.nph: ; preds = %bb3.preheader
+ br label %bb2
+
+bb2: ; preds = %bb3, %bb.nph
+ %distERBlo.03 = phi float [ %tmp19, %bb3 ], [ %distERBlo.0.ph, %bb.nph ] ; <float> [#uses=1]
+ %loPart.02 = phi i32 [ %tmp24, %bb3 ], [ %loPart.118, %bb.nph ] ; <i32> [#uses=3]
+ %peakCount.01 = phi float [ %tmp23, %bb3 ], [ %peakCount.117, %bb.nph ] ; <float> [#uses=1]
+ %tmp16 = sext i32 %loPart.02 to i64 ; <i64> [#uses=1]
+ %tmp17 = getelementptr float* %pTmp1, i64 %tmp16 ; <float*> [#uses=1]
+ %tmp18 = load float* %tmp17, align 4 ; <float> [#uses=1]
+ %tmp19 = fsub float %distERBlo.03, %tmp18 ; <float> [#uses=3]
+ %tmp20 = sext i32 %loPart.02 to i64 ; <i64> [#uses=1]
+ %tmp21 = getelementptr float* %peakWeight, i64 %tmp20 ; <float*> [#uses=1]
+ %tmp22 = load float* %tmp21, align 4 ; <float> [#uses=1]
+ %tmp23 = fsub float %peakCount.01, %tmp22 ; <float> [#uses=2]
+ %tmp24 = add i32 %loPart.02, 1 ; <i32> [#uses=2]
+ br label %bb3
+
+bb3: ; preds = %bb2
+ %tmp25 = fcmp ogt float %tmp19, 2.500000e+00 ; <i1> [#uses=1]
+ br i1 %tmp25, label %bb2, label %bb3.bb5.preheader_crit_edge
+
+bb3.bb5.preheader_crit_edge: ; preds = %bb3
+ %tmp24.lcssa = phi i32 [ %tmp24, %bb3 ] ; <i32> [#uses=1]
+ %tmp23.lcssa = phi float [ %tmp23, %bb3 ] ; <float> [#uses=1]
+ %tmp19.lcssa = phi float [ %tmp19, %bb3 ] ; <float> [#uses=1]
+ br label %bb5.preheader
+
+bb5.preheader: ; preds = %bb3.bb5.preheader_crit_edge, %bb3.preheader
+ %distERBlo.0.lcssa = phi float [ %tmp19.lcssa, %bb3.bb5.preheader_crit_edge ], [ %distERBlo.0.ph, %bb3.preheader ] ; <float> [#uses=2]
+ %loPart.0.lcssa = phi i32 [ %tmp24.lcssa, %bb3.bb5.preheader_crit_edge ], [ %loPart.118, %bb3.preheader ] ; <i32> [#uses=1]
+ %peakCount.0.lcssa = phi float [ %tmp23.lcssa, %bb3.bb5.preheader_crit_edge ], [ %peakCount.117, %bb3.preheader ] ; <float> [#uses=2]
+ %.not10 = fcmp olt float %distERBhi.0.ph, 2.500000e+00 ; <i1> [#uses=1]
+ %tmp26 = icmp sgt i32 %tmp3, %hiPart.119 ; <i1> [#uses=1]
+ %or.cond11 = and i1 %tmp26, %.not10 ; <i1> [#uses=1]
+ br i1 %or.cond11, label %bb.nph12, label %bb7
+
+bb.nph12: ; preds = %bb5.preheader
+ br label %bb4
+
+bb4: ; preds = %bb5, %bb.nph12
+ %distERBhi.29 = phi float [ %tmp30, %bb5 ], [ %distERBhi.0.ph, %bb.nph12 ] ; <float> [#uses=1]
+ %hiPart.08 = phi i32 [ %tmp31, %bb5 ], [ %hiPart.119, %bb.nph12 ] ; <i32> [#uses=2]
+ %peakCount.27 = phi float [ %tmp35, %bb5 ], [ %peakCount.0.lcssa, %bb.nph12 ] ; <float> [#uses=1]
+ %tmp27 = sext i32 %hiPart.08 to i64 ; <i64> [#uses=1]
+ %tmp28 = getelementptr float* %pTmp1, i64 %tmp27 ; <float*> [#uses=1]
+ %tmp29 = load float* %tmp28, align 4 ; <float> [#uses=1]
+ %tmp30 = fadd float %tmp29, %distERBhi.29 ; <float> [#uses=3]
+ %tmp31 = add i32 %hiPart.08, 1 ; <i32> [#uses=4]
+ %tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1]
+ %tmp33 = getelementptr float* %peakWeight, i64 %tmp32 ; <float*> [#uses=1]
+ %tmp34 = load float* %tmp33, align 4 ; <float> [#uses=1]
+ %tmp35 = fadd float %tmp34, %peakCount.27 ; <float> [#uses=2]
+ br label %bb5
+
+bb5: ; preds = %bb4
+ %.not = fcmp olt float %tmp30, 2.500000e+00 ; <i1> [#uses=1]
+ %tmp36 = icmp sgt i32 %tmp3, %tmp31 ; <i1> [#uses=1]
+ %or.cond = and i1 %tmp36, %.not ; <i1> [#uses=1]
+ br i1 %or.cond, label %bb4, label %bb5.bb7_crit_edge
+
+bb5.bb7_crit_edge: ; preds = %bb5
+ %tmp35.lcssa = phi float [ %tmp35, %bb5 ] ; <float> [#uses=1]
+ %tmp31.lcssa = phi i32 [ %tmp31, %bb5 ] ; <i32> [#uses=1]
+ %tmp30.lcssa = phi float [ %tmp30, %bb5 ] ; <float> [#uses=1]
+ br label %bb7
+
+bb7: ; preds = %bb5.bb7_crit_edge, %bb5.preheader
+ %distERBhi.2.lcssa = phi float [ %tmp30.lcssa, %bb5.bb7_crit_edge ], [ %distERBhi.0.ph, %bb5.preheader ] ; <float> [#uses=2]
+ %hiPart.0.lcssa = phi i32 [ %tmp31.lcssa, %bb5.bb7_crit_edge ], [ %hiPart.119, %bb5.preheader ] ; <i32> [#uses=1]
+ %peakCount.2.lcssa = phi float [ %tmp35.lcssa, %bb5.bb7_crit_edge ], [ %peakCount.0.lcssa, %bb5.preheader ] ; <float> [#uses=2]
+ %tmp37 = fadd float %distERBlo.0.lcssa, %distERBhi.2.lcssa ; <float> [#uses=1]
+ %tmp38 = fdiv float %peakCount.2.lcssa, %tmp37 ; <float> [#uses=1]
+ %tmp39 = fmul float %tmp38, %tmp1 ; <float> [#uses=2]
+ %tmp40 = fmul float %tmp39, %tmp39 ; <float> [#uses=2]
+ %tmp41 = fmul float %tmp40, %tmp40 ; <float> [#uses=1]
+ %tmp42 = fadd float %tmp41, 1.000000e+00 ; <float> [#uses=1]
+ %tmp43 = fdiv float 1.000000e+00, %tmp42 ; <float> [#uses=1]
+ %tmp44 = sext i32 %part.016 to i64 ; <i64> [#uses=1]
+ %tmp45 = getelementptr float* %nrgReducePeakrate, i64 %tmp44 ; <float*> [#uses=1]
+ store float %tmp43, float* %tmp45, align 4
+ %tmp46 = add i32 %part.016, 1 ; <i32> [#uses=2]
+ br label %bb8
+
+bb8: ; preds = %bb7
+ %tmp47 = icmp slt i32 %tmp46, %bandEdgeIndex ; <i1> [#uses=1]
+ br i1 %tmp47, label %bb, label %bb8.return_crit_edge
+
+bb8.return_crit_edge: ; preds = %bb8
+ br label %return
+
+return: ; preds = %bb8.return_crit_edge, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/iv-zext.ll b/test/Transforms/IndVarSimplify/iv-zext.ll
index d7eb7bd..1cc559f 100644
--- a/test/Transforms/IndVarSimplify/iv-zext.ll
+++ b/test/Transforms/IndVarSimplify/iv-zext.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: not grep and %t
; RUN: not grep zext %t
diff --git a/test/Transforms/IndVarSimplify/lftr-other-uses.ll b/test/Transforms/IndVarSimplify/lftr-other-uses.ll
index c8f1e95..09ec237 100644
--- a/test/Transforms/IndVarSimplify/lftr-other-uses.ll
+++ b/test/Transforms/IndVarSimplify/lftr-other-uses.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -disable-output
+; RUN: opt < %s -indvars -disable-output
; Don't RAUW the loop's original comparison instruction if it has
; other uses which aren't dominated by the new comparison instruction.
diff --git a/test/Transforms/IndVarSimplify/lftr-promote.ll b/test/Transforms/IndVarSimplify/lftr-promote.ll
new file mode 100644
index 0000000..c4ecc84
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/lftr-promote.ll
@@ -0,0 +1,38 @@
+; RUN: opt < %s -indvars -S | grep add | count 1
+
+; Indvars should be able to compute the exit value of this loop
+; without any additional arithmetic. The only add needed should
+; be the canonical IV increment.
+
+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"
+
+define void @foo(double* %p, i32 %n) nounwind {
+entry:
+ %0 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
+ br i1 %0, label %bb.nph, label %return
+
+bb.nph: ; preds = %entry
+ br label %bb2
+
+bb2: ; preds = %bb3, %bb.nph
+ %i.01 = phi i32 [ %7, %bb3 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
+ %1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %2 = getelementptr double* %p, i64 %1 ; <double*> [#uses=1]
+ %3 = load double* %2, align 8 ; <double> [#uses=1]
+ %4 = fmul double %3, 1.100000e+00 ; <double> [#uses=1]
+ %5 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
+ %6 = getelementptr double* %p, i64 %5 ; <double*> [#uses=1]
+ store double %4, double* %6, align 8
+ %7 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ br label %bb3
+
+bb3: ; preds = %bb2
+ %8 = icmp slt i32 %7, %n ; <i1> [#uses=1]
+ br i1 %8, label %bb2, label %bb3.return_crit_edge
+
+bb3.return_crit_edge: ; preds = %bb3
+ br label %return
+
+return: ; preds = %bb3.return_crit_edge, %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/lftr_simple.ll b/test/Transforms/IndVarSimplify/lftr_simple.ll
index 3f7c289..e373013 100644
--- a/test/Transforms/IndVarSimplify/lftr_simple.ll
+++ b/test/Transforms/IndVarSimplify/lftr_simple.ll
@@ -1,6 +1,6 @@
; LFTR should eliminate the need for the computation of i*i completely. It
; is only used to compute the exit value.
-; RUN: llvm-as < %s | opt -indvars -dce | llvm-dis | not grep mul
+; RUN: opt < %s -indvars -dce -S | not grep mul
@A = external global i32 ; <i32*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/loop-invariant-step.ll b/test/Transforms/IndVarSimplify/loop-invariant-step.ll
index 40156ea..2d2d1fe 100644
--- a/test/Transforms/IndVarSimplify/loop-invariant-step.ll
+++ b/test/Transforms/IndVarSimplify/loop-invariant-step.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -loop-index-split -instcombine -indvars -disable-output
+; RUN: opt < %s -loop-index-split -instcombine -indvars -disable-output
; PR4455
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"
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate10.ll b/test/Transforms/IndVarSimplify/loop_evaluate10.ll
new file mode 100644
index 0000000..4ec4aca
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate10.ll
@@ -0,0 +1,47 @@
+; RUN: opt < %s -indvars -S \
+; RUN: | grep {%b.1 = phi i32 \\\[ 2, %bb \\\], \\\[ 1, %bb2 \\\]}
+
+; This loop has multiple exits, and the value of %b1 depends on which
+; exit is taken. Indvars should correctly compute the exit values.
+
+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-linux-gnu"
+ %struct..0anon = type <{ i8, [3 x i8] }>
+
+define i32 @main() nounwind {
+entry:
+ br label %bb2
+
+bb2: ; preds = %bb, %entry
+ %sdata.0 = phi i32 [ 1, %entry ], [ %ins10, %bb ] ; <i32> [#uses=2]
+ %b.0 = phi i32 [ 0, %entry ], [ %t0, %bb ] ; <i32> [#uses=2]
+ %tmp6 = trunc i32 %sdata.0 to i8 ; <i8> [#uses=2]
+ %t2 = and i8 %tmp6, 1 ; <i8> [#uses=1]
+ %t3 = icmp eq i8 %t2, 0 ; <i1> [#uses=1]
+ %t4 = xor i8 %tmp6, 1 ; <i8> [#uses=1]
+ %tmp8 = zext i8 %t4 to i32 ; <i32> [#uses=1]
+ %mask9 = and i32 %sdata.0, -256 ; <i32> [#uses=1]
+ %ins10 = or i32 %tmp8, %mask9 ; <i32> [#uses=1]
+ br i1 %t3, label %bb3, label %bb
+
+bb: ; preds = %bb2
+ %t0 = add i32 %b.0, 1 ; <i32> [#uses=3]
+ %t1 = icmp sgt i32 %t0, 100 ; <i1> [#uses=1]
+ br i1 %t1, label %bb3, label %bb2
+
+bb3: ; preds = %bb, %bb2
+ %b.1 = phi i32 [ %t0, %bb ], [ %b.0, %bb2 ] ; <i32> [#uses=1]
+ %t5 = icmp eq i32 %b.1, 1 ; <i1> [#uses=1]
+ br i1 %t5, label %bb5, label %bb4
+
+bb4: ; preds = %bb3
+ tail call void @abort() noreturn nounwind
+ unreachable
+
+bb5: ; preds = %bb3
+ ret i32 0
+}
+
+declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind
+
+declare void @abort() noreturn nounwind
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate11.ll b/test/Transforms/IndVarSimplify/loop_evaluate11.ll
new file mode 100644
index 0000000..40b785e
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/loop_evaluate11.ll
@@ -0,0 +1,36 @@
+; RUN: opt < %s -domfrontier -indvars -loop-deletion
+
+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"
+
+define void @slap_sl_mem_create() nounwind {
+entry:
+ br label %bb15
+
+bb15: ; preds = %bb15, %entry
+ %order_end.0 = phi i32 [ 0, %entry ], [ %tmp, %bb15 ] ; <i32> [#uses=1]
+ %tmp = add i32 %order_end.0, 1 ; <i32> [#uses=2]
+ br i1 undef, label %bb17, label %bb15
+
+bb17: ; preds = %bb17, %bb15
+ %order_start.0 = phi i32 [ %tmp1, %bb17 ], [ 0, %bb15 ] ; <i32> [#uses=2]
+ %tmp1 = add i32 %order_start.0, 1 ; <i32> [#uses=2]
+ %tmp2 = icmp eq i32 undef, 0 ; <i1> [#uses=1]
+ br i1 %tmp2, label %bb18, label %bb17
+
+bb18: ; preds = %bb17
+ %tmp3 = sub i32 %tmp, %tmp1 ; <i32> [#uses=0]
+ br label %bb59
+
+bb51: ; preds = %bb59
+ %tmp4 = add i32 %order_start.0, 2 ; <i32> [#uses=1]
+ %tmp5 = add i32 %tmp4, undef ; <i32> [#uses=1]
+ %tmp6 = lshr i32 undef, %tmp5 ; <i32> [#uses=1]
+ %tmp7 = icmp eq i32 %tmp6, 0 ; <i1> [#uses=1]
+ br i1 %tmp7, label %bb52, label %bb59
+
+bb59: ; preds = %bb51, %bb18
+ br label %bb51
+
+bb52: ; preds = %bb51
+ unreachable
+}
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate7.ll b/test/Transforms/IndVarSimplify/loop_evaluate7.ll
index 6e31c55..b9c0b12 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate7.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate7.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR4436
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/IndVarSimplify/loop_evaluate8.ll b/test/Transforms/IndVarSimplify/loop_evaluate8.ll
index fa2f9e5..2a9d205 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate8.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate8.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | not grep select
+; RUN: opt < %s -indvars -S | not grep select
; This loop has backedge-taken-count zero. Indvars shouldn't expand any
; instructions to compute a trip count.
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate9.ll b/test/Transforms/IndVarSimplify/loop_evaluate9.ll
index 5a7a859..8184a73 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate9.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate9.ll
@@ -1,6 +1,6 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
-; RUN: grep {\[%\]tmp5.lcssa = phi i8 \\\[ 63, \[%\]cc70a02__complex_integers__Oadd.153.exit.i \\\]} %t
-; RUN: grep {\[%\]tmp4.lcssa = phi i8 \\\[ -28, \[%\]cc70a02__complex_integers__Oadd.153.exit.i \\\]} %t
+; RUN: opt < %s -indvars -S > %t
+; RUN: grep {\[%\]tmp7 = icmp eq i8 -28, -28} %t
+; RUN: grep {\[%\]tmp8 = icmp eq i8 63, 63} %t
; PR4477
; Indvars should compute the exit values in loop.
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_1.ll b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
index dfb42e4..abf1bc3 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
+; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | not grep br
;
; Testcase distilled from 256.bzip2
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_2.ll b/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
index efcf20a..c0099a8 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | opt \
+; RUN: opt < %s -indvars -loop-deletion -simplifycfg | opt \
; RUN: -analyze -loops | not grep "^Loop Containing"
; PR1179
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_3.ll b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll
index 2a2f69d..65c66f7 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_3.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_3.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {ret i32 600000}
+; RUN: opt < %s -indvars -S | grep {ret i32 600000}
; PR1179
define i32 @foo() {
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_4.ll b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll
index 6c6a362..e4b642c 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_4.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_4.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {ret i32 9900}
+; RUN: opt < %s -indvars -S | grep {ret i32 9900}
; PR1179
define i32 @test4() {
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_5.ll b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll
index c6ce4a2..80b961a 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_5.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_5.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep {120, %bb2.bb3_crit_edge}
+; RUN: opt < %s -indvars -S | grep {120, %bb2.bb3_crit_edge}
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 = "i686-pc-linux-gnu"
diff --git a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
index 0d17a80..da38de5 100644
--- a/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
+++ b/test/Transforms/IndVarSimplify/loop_evaluate_6.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -loop-deletion | llvm-dis | grep phi | count 1
+; RUN: opt < %s -indvars -loop-deletion -S | grep phi | count 1
; XFAIL: *
; Indvars can't evaluate this loop, because ScalarEvolution can't compute
diff --git a/test/Transforms/IndVarSimplify/masked-iv.ll b/test/Transforms/IndVarSimplify/masked-iv.ll
index f77b935..f1f5af9 100644
--- a/test/Transforms/IndVarSimplify/masked-iv.ll
+++ b/test/Transforms/IndVarSimplify/masked-iv.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: not grep trunc %t
; RUN: grep and %t | count 1
diff --git a/test/Transforms/IndVarSimplify/max-pointer.ll b/test/Transforms/IndVarSimplify/max-pointer.ll
new file mode 100644
index 0000000..71bc720
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/max-pointer.ll
@@ -0,0 +1,39 @@
+; RUN: opt < %s -indvars -S > %t
+; RUN: grep {icmp ugt i8\\\*} %t | count 1
+; RUN: grep {icmp sgt i8\\\*} %t | count 1
+
+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"
+
+ %struct.CKenCodeCodec = type <{ i8 }>
+
+define void @foo(i8* %str1Ptr, i8* %str2Ptr, i8* %inLastBytePtr) nounwind {
+entry:
+ %0 = icmp ult i8* %str2Ptr, %str1Ptr ; <i1> [#uses=1]
+ %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; <i8*> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb2, %entry
+ %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; <i8*> [#uses=1]
+ %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; <i8*> [#uses=2]
+ %2 = icmp ult i8* %1, %inLastBytePtr ; <i1> [#uses=0]
+ br i1 false, label %bb2, label %return
+
+return: ; preds = %bb2
+ ret void
+}
+
+define void @sfoo(i8* %str1Ptr, i8* %str2Ptr, i8* %inLastBytePtr) nounwind {
+entry:
+ %0 = icmp slt i8* %str2Ptr, %str1Ptr ; <i1> [#uses=1]
+ %str2Ptr_addr.0 = select i1 %0, i8* %str1Ptr, i8* %str2Ptr ; <i8*> [#uses=1]
+ br label %bb2
+
+bb2: ; preds = %bb2, %entry
+ %str2Ptr_addr.1 = phi i8* [ %str2Ptr_addr.0, %entry ], [ %1, %bb2 ] ; <i8*> [#uses=1]
+ %1 = getelementptr i8* %str2Ptr_addr.1, i64 1 ; <i8*> [#uses=2]
+ %2 = icmp slt i8* %1, %inLastBytePtr ; <i1> [#uses=0]
+ br i1 false, label %bb2, label %return
+
+return: ; preds = %bb2
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll b/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
index 7119cbb..34d432b 100644
--- a/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
+++ b/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
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"
@ue = external global i64
diff --git a/test/Transforms/IndVarSimplify/pointer-indvars.ll b/test/Transforms/IndVarSimplify/pointer-indvars.ll
index c9da1579..6d25f90 100644
--- a/test/Transforms/IndVarSimplify/pointer-indvars.ll
+++ b/test/Transforms/IndVarSimplify/pointer-indvars.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+; RUN: opt < %s -indvars -S | grep indvar
@G = global i32* null ; <i32**> [#uses=1]
@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/pointer.ll b/test/Transforms/IndVarSimplify/pointer.ll
index 7ad1161..5eee655 100644
--- a/test/Transforms/IndVarSimplify/pointer.ll
+++ b/test/Transforms/IndVarSimplify/pointer.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep {%exitcond = icmp eq i64 %indvar.next, %n} %t
; RUN: grep {getelementptr i8\\* %A, i64 %indvar} %t
; RUN: grep getelementptr %t | count 1
diff --git a/test/Transforms/IndVarSimplify/polynomial-expand.ll b/test/Transforms/IndVarSimplify/polynomial-expand.ll
new file mode 100644
index 0000000..2087f6a
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/polynomial-expand.ll
@@ -0,0 +1,38 @@
+; RUN: opt < %s -indvars -disable-output
+; PR5073
+
+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"
+
+define void @ctpmv_(float* noalias nocapture %tmp4, i32 %tmp21) nounwind {
+bb20: ; preds = %bb19
+ br label %bb24
+
+bb24: ; preds = %bb40, %bb23
+ %tmp25 = phi i32 [ %tmp43, %bb40 ], [ %tmp21, %bb20 ] ; <i32> [#uses=4]
+ %tmp26 = phi i32 [ %tmp41, %bb40 ], [ undef, %bb20 ] ; <i32> [#uses=2]
+ %tmp27 = add nsw i32 %tmp26, -1 ; <i32> [#uses=1]
+ %tmp28 = add nsw i32 %tmp25, -1 ; <i32> [#uses=2]
+ %tmp29 = icmp sgt i32 %tmp28, 0 ; <i1> [#uses=1]
+ br i1 %tmp29, label %bb30, label %bb40
+
+bb30: ; preds = %bb30, %bb24
+ %tmp31 = phi i32 [ %tmp39, %bb30 ], [ %tmp28, %bb24 ] ; <i32> [#uses=2]
+ %tmp32 = phi i32 [ %tmp37, %bb30 ], [ %tmp27, %bb24 ] ; <i32> [#uses=2]
+ %tmp33 = sext i32 %tmp32 to i64 ; <i64> [#uses=1]
+ %tmp35 = getelementptr float* %tmp4, i64 %tmp33 ; <%0*> [#uses=1]
+ %tmp36 = load float* %tmp35, align 4 ; <%0> [#uses=0]
+ %tmp37 = add nsw i32 %tmp32, -1 ; <i32> [#uses=1]
+ %tmp39 = add nsw i32 %tmp31, -1 ; <i32> [#uses=1]
+ %tmp38 = icmp eq i32 %tmp31, 1 ; <i1> [#uses=1]
+ br i1 %tmp38, label %bb40, label %bb30
+
+bb40: ; preds = %bb30, %bb24
+ %tmp41 = sub i32 %tmp26, %tmp25 ; <i32> [#uses=1]
+ %tmp43 = add nsw i32 %tmp25, -1 ; <i32> [#uses=1]
+ %tmp42 = icmp eq i32 %tmp25, 1 ; <i1> [#uses=1]
+ br i1 %tmp42, label %bb46, label %bb24
+
+bb46: ; preds = %bb40, %bb23, %bb19
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll
new file mode 100644
index 0000000..86e90c7
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/preserve-gep-loop-variant.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -indvars -S > %t
+; RUN: not grep inttoptr %t
+; RUN: not grep ptrtoint %t
+; RUN: grep scevgep %t
+
+; Indvars shouldn't need inttoptr/ptrtoint to expand an address here.
+
+define void @foo(i8* %p) nounwind {
+entry:
+ br i1 true, label %bb.nph, label %for.end
+
+for.cond:
+ %phitmp = icmp slt i64 %inc, 20
+ br i1 %phitmp, label %for.body, label %for.cond.for.end_crit_edge
+
+for.cond.for.end_crit_edge:
+ br label %for.end
+
+bb.nph:
+ br label %for.body
+
+for.body:
+ %storemerge1 = phi i64 [ %inc, %for.cond ], [ 0, %bb.nph ]
+ %call = tail call i64 @bar() nounwind
+ %call2 = tail call i64 @car() nounwind
+ %conv = trunc i64 %call2 to i8
+ %conv3 = sext i8 %conv to i64
+ %add = add nsw i64 %call, %storemerge1
+ %add4 = add nsw i64 %add, %conv3
+ %arrayidx = getelementptr inbounds i8* %p, i64 %add4
+ store i8 0, i8* %arrayidx
+ %inc = add nsw i64 %storemerge1, 1
+ br label %for.cond
+
+for.end:
+ ret void
+}
+
+declare i64 @bar()
+
+declare i64 @car()
diff --git a/test/Transforms/IndVarSimplify/preserve-gep-nested.ll b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll
new file mode 100644
index 0000000..bb0993c
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/preserve-gep-nested.ll
@@ -0,0 +1,75 @@
+; RUN: opt < %s -indvars -S > %t
+; Exactly one getelementptr for each load+store.
+; RUN: grep getelementptr %t | count 6
+; Each getelementptr using %struct.Q* %s as a base and not i8*.
+; RUN: grep {getelementptr \[%\]struct\\.Q\\* \[%\]s,} %t | count 6
+; No explicit integer multiplications!
+; RUN: not grep {= mul} %t
+; No i8* arithmetic or pointer casting anywhere!
+; RUN: not grep {i8\\*} %t
+; RUN: not grep bitcast %t
+; RUN: not grep inttoptr %t
+; RUN: not grep ptrtoint %t
+
+; FIXME: This test should pass with or without TargetData. Until opt
+; supports running tests without targetdata, just hardware this in.
+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"
+
+%struct.Q = type { [10 x %struct.N] }
+%struct.N = type { %struct.S }
+%struct.S = type { [100 x double], [100 x double] }
+
+define void @foo(%struct.Q* %s, i64 %n) nounwind {
+entry:
+ br label %bb1
+
+bb1:
+ %i = phi i64 [ 2, %entry ], [ %i.next, %bb ]
+ %j = phi i64 [ 0, %entry ], [ %j.next, %bb ]
+ %t5 = icmp slt i64 %i, %n
+ br i1 %t5, label %bb, label %return
+
+bb:
+ %t0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i
+ %t1 = load double* %t0, align 8
+ %t2 = fmul double %t1, 3.200000e+00
+ %t3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %i
+ store double %t2, double* %t3, align 8
+
+ %s0 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i
+ %s1 = load double* %s0, align 8
+ %s2 = fmul double %s1, 3.200000e+00
+ %s3 = getelementptr inbounds %struct.Q* %s, i64 13, i32 0, i64 7, i32 0, i32 1, i64 %i
+ store double %s2, double* %s3, align 8
+
+ %u0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j
+ %u1 = load double* %u0, align 8
+ %u2 = fmul double %u1, 3.200000e+00
+ %u3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 7, i32 0, i32 1, i64 %j
+ store double %u2, double* %u3, align 8
+
+ %v0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i
+ %v1 = load double* %v0, align 8
+ %v2 = fmul double %v1, 3.200000e+00
+ %v3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 1, i64 %i
+ store double %v2, double* %v3, align 8
+
+ %w0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j
+ %w1 = load double* %w0, align 8
+ %w2 = fmul double %w1, 3.200000e+00
+ %w3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 0, i32 0, i32 0, i64 %j
+ store double %w2, double* %w3, align 8
+
+ %x0 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i
+ %x1 = load double* %x0, align 8
+ %x2 = fmul double %x1, 3.200000e+00
+ %x3 = getelementptr inbounds %struct.Q* %s, i64 0, i32 0, i64 3, i32 0, i32 0, i64 %i
+ store double %x2, double* %x3, align 8
+
+ %i.next = add i64 %i, 1
+ %j.next = add i64 %j, 1
+ br label %bb1
+
+return:
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll
index 95726ea..d249432 100644
--- a/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll
+++ b/test/Transforms/IndVarSimplify/preserve-gep-remainder.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis \
+; RUN: opt < %s -indvars -S \
; RUN: | grep {\[%\]p.2.ip.1 = getelementptr \\\[3 x \\\[3 x double\\\]\\\]\\* \[%\]p, i64 2, i64 \[%\]tmp, i64 1}
; Indvars shouldn't expand this to
diff --git a/test/Transforms/IndVarSimplify/preserve-gep.ll b/test/Transforms/IndVarSimplify/preserve-gep.ll
index 2c8c224..a27d20d 100644
--- a/test/Transforms/IndVarSimplify/preserve-gep.ll
+++ b/test/Transforms/IndVarSimplify/preserve-gep.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: not grep ptrtoint %t
; RUN: not grep inttoptr %t
; RUN: grep getelementptr %t | count 1
diff --git a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
index 0a91ec8..9e46a78 100644
--- a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
+++ b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: grep sext %t | count 1
; RUN: grep phi %t | count 1
; RUN: grep {phi i64} %t
diff --git a/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
index 48c060c..a007ca6 100644
--- a/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
+++ b/test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: not grep sext %t
define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly {
diff --git a/test/Transforms/IndVarSimplify/shrunk-constant.ll b/test/Transforms/IndVarSimplify/shrunk-constant.ll
index 0b2ecaf..623c528 100644
--- a/test/Transforms/IndVarSimplify/shrunk-constant.ll
+++ b/test/Transforms/IndVarSimplify/shrunk-constant.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -scalar-evolution -analyze -disable-output \
+; RUN: opt < %s -scalar-evolution -analyze -disable-output \
; RUN: | grep {\\--> (zext i4 {-7,+,-8}<loop> to i32)}
define fastcc void @foo() nounwind {
diff --git a/test/Transforms/IndVarSimplify/signed-trip-count.ll b/test/Transforms/IndVarSimplify/signed-trip-count.ll
index cd61d11..1a5e64d 100644
--- a/test/Transforms/IndVarSimplify/signed-trip-count.ll
+++ b/test/Transforms/IndVarSimplify/signed-trip-count.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
+; RUN: opt < %s -indvars -S > %t
; RUN: not grep sext %t
; RUN: grep phi %t | count 1
diff --git a/test/Transforms/IndVarSimplify/single-element-range.ll b/test/Transforms/IndVarSimplify/single-element-range.ll
new file mode 100644
index 0000000..60a9eef
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/single-element-range.ll
@@ -0,0 +1,27 @@
+; RUN: opt < %s -indvars
+
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64"
+target triple = "armv6-apple-darwin10"
+
+define arm_apcscc void @sqlite3_free_table(i8** %azResult) nounwind {
+entry:
+ br i1 undef, label %return, label %bb
+
+bb: ; preds = %entry
+ %0 = load i8** undef, align 4 ; <i8*> [#uses=2]
+ %1 = ptrtoint i8* %0 to i32 ; <i32> [#uses=1]
+ %2 = icmp sgt i8* %0, inttoptr (i32 1 to i8*) ; <i1> [#uses=1]
+ br i1 %2, label %bb1, label %bb5
+
+bb1: ; preds = %bb1, %bb
+ %i.01 = phi i32 [ %3, %bb1 ], [ 1, %bb ] ; <i32> [#uses=1]
+ %3 = add i32 %i.01, 1 ; <i32> [#uses=2]
+ %4 = icmp slt i32 %3, %1 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb5
+
+bb5: ; preds = %bb1, %bb
+ ret void
+
+return: ; preds = %entry
+ ret void
+}
diff --git a/test/Transforms/IndVarSimplify/sink-alloca.ll b/test/Transforms/IndVarSimplify/sink-alloca.ll
new file mode 100644
index 0000000..3a6c683
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/sink-alloca.ll
@@ -0,0 +1,31 @@
+; RUN: opt < %s -indvars -S | FileCheck %s
+; PR4775
+
+; Indvars shouldn't sink the alloca out of the entry block, even though
+; it's not used until after the loop.
+
+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"
+
+@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @main to i8*)],
+section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
+
+define i32 @main() nounwind {
+; CHECK: entry:
+; CHECK-NEXT: %result.i = alloca i32, align 4
+entry:
+ %result.i = alloca i32, align 4 ; <i32*> [#uses=2]
+ br label %while.cond
+
+while.cond: ; preds = %while.cond, %entry
+ %call = call i32 @bar() nounwind ; <i32> [#uses=1]
+ %tobool = icmp eq i32 %call, 0 ; <i1> [#uses=1]
+ br i1 %tobool, label %while.end, label %while.cond
+
+while.end: ; preds = %while.cond
+ volatile store i32 0, i32* %result.i
+ %tmp.i = volatile load i32* %result.i ; <i32> [#uses=0]
+ ret i32 0
+}
+
+declare i32 @bar()
diff --git a/test/Transforms/IndVarSimplify/sink-trapping.ll b/test/Transforms/IndVarSimplify/sink-trapping.ll
new file mode 100644
index 0000000..a18000c
--- /dev/null
+++ b/test/Transforms/IndVarSimplify/sink-trapping.ll
@@ -0,0 +1,19 @@
+; RUN: opt < %s -indvars -S | FileCheck %s --check-prefix=CHECK
+
+declare i1 @b()
+
+define i32 @a(i32 %x) nounwind {
+for.body.preheader:
+ %y = sdiv i32 10, %x
+ br label %for.body
+
+for.body:
+ %cmp = call i1 @b()
+ br i1 %cmp, label %for.body, label %for.end.loopexit
+
+for.end.loopexit:
+ ret i32 %y
+}
+; CHECK: for.end.loopexit:
+; CHECK: sdiv
+; CHECK: ret
diff --git a/test/Transforms/IndVarSimplify/subtract.ll b/test/Transforms/IndVarSimplify/subtract.ll
index 51065cc..f45bdab 100644
--- a/test/Transforms/IndVarSimplify/subtract.ll
+++ b/test/Transforms/IndVarSimplify/subtract.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep indvar
+; RUN: opt < %s -indvars -S | grep indvar
@G = global i64 0 ; <i64*> [#uses=1]
diff --git a/test/Transforms/IndVarSimplify/tripcount_compute.ll b/test/Transforms/IndVarSimplify/tripcount_compute.ll
index 9ffce81..6eaa4c5 100644
--- a/test/Transforms/IndVarSimplify/tripcount_compute.ll
+++ b/test/Transforms/IndVarSimplify/tripcount_compute.ll
@@ -3,7 +3,7 @@
; the exit value of the loop will be for some value, allowing us to substitute
; it directly into users outside of the loop, making the loop dead.
;
-; RUN: llvm-as < %s | opt -indvars -loop-deletion -simplifycfg | llvm-dis | not grep br
+; RUN: opt < %s -indvars -loop-deletion -simplifycfg -S | not grep br
define i32 @linear_setne() {
entry:
diff --git a/test/Transforms/IndVarSimplify/tripcount_infinite.ll b/test/Transforms/IndVarSimplify/tripcount_infinite.ll
index d5965f4..0495b50 100644
--- a/test/Transforms/IndVarSimplify/tripcount_infinite.ll
+++ b/test/Transforms/IndVarSimplify/tripcount_infinite.ll
@@ -1,7 +1,7 @@
; These tests have an infinite trip count. We obviously shouldn't remove the
; loops! :)
;
-; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
+; RUN: opt < %s -indvars -adce -simplifycfg -S | grep icmp | wc -l > %t2
; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
; RUN: diff %t1 %t2
diff --git a/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll b/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll
index 759ba8e..0c8857f 100644
--- a/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll
+++ b/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars -instcombine | llvm-dis | \
+; RUN: opt < %s -indvars -instcombine -S | \
; RUN: grep {store i32 0}
; Test that -indvars can reduce variable stride IVs. If it can reduce variable
; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without
diff --git a/test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll b/test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll
index 075e899..98cfa34 100644
--- a/test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll
+++ b/test/Transforms/IndVarSimplify/variable-stride-ivs-1.ll
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -indvars
+; RUN: opt < %s -indvars
; PR4315
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-f80:128:128"
OpenPOWER on IntegriCloud