diff options
author | Dan Gohman <gohman@apple.com> | 2009-05-12 02:17:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-05-12 02:17:14 +0000 |
commit | 81db61a2e6d3c95a2738c3559a108e05e9d7a05a (patch) | |
tree | 3f5da42b9778500f8db915f31c8003baa064f862 /test/CodeGen | |
parent | efb9fbfdab6cab88146792a5db79315313270c7f (diff) | |
download | external_llvm-81db61a2e6d3c95a2738c3559a108e05e9d7a05a.zip external_llvm-81db61a2e6d3c95a2738c3559a108e05e9d7a05a.tar.gz external_llvm-81db61a2e6d3c95a2738c3559a108e05e9d7a05a.tar.bz2 |
Factor the code for collecting IV users out of LSR into an IVUsers class,
and generalize it so that it can be used by IndVarSimplify. Implement the
base IndVarSimplify transformation code using IVUsers. This removes
TestOrigIVForWrap and associated code, as ScalarEvolution now has enough
builtin overflow detection and folding logic to handle all the same cases,
and more. Run "opt -iv-users -analyze -disable-output" on your favorite
loop for an example of what IVUsers does.
This lets IndVarSimplify eliminate IV casts and compute trip counts in
more cases. Also, this happens to finally fix the remaining testcases
in PR1301.
Now that IndVarSimplify is being more aggressive, it occasionally runs
into the problem where ScalarEvolutionExpander's code for avoiding
duplicate expansions makes it difficult to ensure that all expanded
instructions dominate all the instructions that will use them. As a
temporary measure, IndVarSimplify now uses a FixUsesBeforeDefs function
to fix up instructions inserted by SCEVExpander. Fortunately, this code
is contained, and can be easily removed once a more comprehensive
solution is available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/X86/iv-users-in-other-loops.ll | 9 | ||||
-rw-r--r-- | test/CodeGen/X86/masked-iv-safe.ll | 7 | ||||
-rw-r--r-- | test/CodeGen/X86/subreg-to-reg-5.ll | 7 |
3 files changed, 12 insertions, 11 deletions
diff --git a/test/CodeGen/X86/iv-users-in-other-loops.ll b/test/CodeGen/X86/iv-users-in-other-loops.ll index d11b025..275feba 100644 --- a/test/CodeGen/X86/iv-users-in-other-loops.ll +++ b/test/CodeGen/X86/iv-users-in-other-loops.ll @@ -1,10 +1,11 @@ ; RUN: llvm-as < %s | llc -march=x86-64 -f -o %t ; RUN: grep inc %t | count 1 ; RUN: grep dec %t | count 2 -; RUN: grep addq %t | count 13 -; RUN: grep leaq %t | count 8 -; RUN: grep leal %t | count 4 -; RUN: grep movq %t | count 5 +; RUN: grep addq %t | count 8 +; RUN: grep addb %t | count 2 +; RUN: grep leaq %t | count 12 +; RUN: grep leal %t | count 2 +; RUN: grep movq %t | count 4 ; IV users in each of the loops from other loops shouldn't cause LSR ; to insert new induction variables. Previously it would create a diff --git a/test/CodeGen/X86/masked-iv-safe.ll b/test/CodeGen/X86/masked-iv-safe.ll index e9b80a4..e102535 100644 --- a/test/CodeGen/X86/masked-iv-safe.ll +++ b/test/CodeGen/X86/masked-iv-safe.ll @@ -3,14 +3,13 @@ ; RUN: not grep movz %t ; RUN: not grep sar %t ; RUN: not grep shl %t -; RUN: grep add %t | count 6 -; RUN: grep inc %t | count 2 -; RUN: grep dec %t | count 4 +; RUN: grep add %t | count 2 +; RUN: grep inc %t | count 4 +; RUN: grep dec %t | count 2 ; RUN: grep lea %t | count 2 ; Optimize away zext-inreg and sext-inreg on the loop induction ; variable using trip-count information. -; Also, the loop-reversal algorithm kicks in twice. define void @count_up(double* %d, i64 %n) nounwind { entry: diff --git a/test/CodeGen/X86/subreg-to-reg-5.ll b/test/CodeGen/X86/subreg-to-reg-5.ll index eee751a..81b262a 100644 --- a/test/CodeGen/X86/subreg-to-reg-5.ll +++ b/test/CodeGen/X86/subreg-to-reg-5.ll @@ -8,7 +8,8 @@ entry: bb2: ; preds = %bb3, %entry %B_addr.0.rec = phi i64 [ %indvar.next154, %bb3 ], [ 0, %entry ] ; <i64> [#uses=2] - br i1 false, label %bb3, label %bb4 + %z = icmp slt i64 %B_addr.0.rec, 20000 + br i1 %z, label %bb3, label %bb4 bb3: ; preds = %bb2 %indvar.next154 = add i64 %B_addr.0.rec, 1 ; <i64> [#uses=1] @@ -17,7 +18,7 @@ bb3: ; preds = %bb2 bb4: ; preds = %bb2 %B_addr.0 = getelementptr float* %B, i64 %B_addr.0.rec ; <float*> [#uses=1] %t1 = ptrtoint float* %B_addr.0 to i64 ; <i64> [#uses=1] - %t2 = and i64 %t1, 15 ; <i64> [#uses=1] + %t2 = and i64 %t1, 4294967295 ; <i64> [#uses=1] %t3 = icmp eq i64 %t2, 0 ; <i1> [#uses=1] br i1 %t3, label %bb5, label %bb10.preheader @@ -25,7 +26,7 @@ bb10.preheader: ; preds = %bb4 br label %bb9 bb5: ; preds = %bb4 - unreachable + ret float 7.0 bb9: ; preds = %bb10.preheader %t5 = getelementptr float* %B, i64 0 ; <float*> [#uses=1] |