diff options
| author | Dale Johannesen <dalej@apple.com> | 2009-05-11 17:15:42 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2009-05-11 17:15:42 +0000 |
| commit | 02cb2bf2e347066cfe03e63cb10079229f2719e1 (patch) | |
| tree | 15c4954cad5f8e1e6a6cdfba0c648e777dfbe9db /llvm/test/CodeGen/X86 | |
| parent | dd437d3a26265eaf3ceb7c47f9cae5dc8cd35e0b (diff) | |
| download | bcm5719-llvm-02cb2bf2e347066cfe03e63cb10079229f2719e1.tar.gz bcm5719-llvm-02cb2bf2e347066cfe03e63cb10079229f2719e1.zip | |
Reverse a loop that is counting up to a maximum to
count down to 0 instead, under very restricted
circumstances. Adjust 4 testcases in which this
optimization fires.
llvm-svn: 71439
Diffstat (limited to 'llvm/test/CodeGen/X86')
| -rw-r--r-- | llvm/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/iv-users-in-other-loops.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/masked-iv-safe.ll | 5 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/pr3495.ll | 3 |
4 files changed, 11 insertions, 5 deletions
diff --git a/llvm/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll b/llvm/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll index df6d76a0930..1b36fcec67a 100644 --- a/llvm/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll +++ b/llvm/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll @@ -1,5 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats |& \ ; RUN: grep {1 .*folded into instructions} +; Increment in loop bb.128.i adjusted to 2, to prevent loop reversal from +; kicking in. declare fastcc void @rdft(i32, i32, double*, i32*, double*) @@ -41,7 +43,7 @@ bb.i28.i: ; preds = %bb.i28.i, %cond_next36.i %tmp1213.i23.i = sitofp i32 %x.0.i21.i to double ; <double> [#uses=1] %tmp15.i24.i = sub double 0.000000e+00, %tmp1213.i23.i ; <double> [#uses=1] %tmp16.i25.i = mul double 0.000000e+00, %tmp15.i24.i ; <double> [#uses=1] - %indvar.next39.i = add i32 %j.0.reg2mem.0.i16.i, 1 ; <i32> [#uses=2] + %indvar.next39.i = add i32 %j.0.reg2mem.0.i16.i, 2 ; <i32> [#uses=2] %exitcond40.i = icmp eq i32 %indvar.next39.i, %tmp8.i14.i ; <i1> [#uses=1] br i1 %exitcond40.i, label %mp_unexp_d2mp.exit29.i, label %bb.i28.i diff --git a/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll b/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll index 67d9d49a44f..d11b025d589 100644 --- a/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll +++ b/llvm/test/CodeGen/X86/iv-users-in-other-loops.ll @@ -1,5 +1,6 @@ ; RUN: llvm-as < %s | llc -march=x86-64 -f -o %t -; RUN: grep inc %t | count 2 +; 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 @@ -8,6 +9,7 @@ ; IV users in each of the loops from other loops shouldn't cause LSR ; to insert new induction variables. Previously it would create a ; flood of new induction variables. +; Also, the loop reversal should kick in once. 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/llvm/test/CodeGen/X86/masked-iv-safe.ll b/llvm/test/CodeGen/X86/masked-iv-safe.ll index 2ba3f830fdb..e9b80a4c42c 100644 --- a/llvm/test/CodeGen/X86/masked-iv-safe.ll +++ b/llvm/test/CodeGen/X86/masked-iv-safe.ll @@ -4,12 +4,13 @@ ; RUN: not grep sar %t ; RUN: not grep shl %t ; RUN: grep add %t | count 6 -; RUN: grep inc %t | count 4 -; RUN: grep dec %t | count 2 +; RUN: grep inc %t | count 2 +; RUN: grep dec %t | count 4 ; 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/llvm/test/CodeGen/X86/pr3495.ll b/llvm/test/CodeGen/X86/pr3495.ll index 726ad7413b0..62382c6d78c 100644 --- a/llvm/test/CodeGen/X86/pr3495.ll +++ b/llvm/test/CodeGen/X86/pr3495.ll @@ -1,7 +1,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -stats |& grep {Number of reloads omited} | grep 2 ; RUN: llvm-as < %s | llc -march=x86 -stats |& not grep {Number of available reloads turned into copies} -; RUN: llvm-as < %s | llc -march=x86 -stats |& grep {Number of machine instrs printed} | grep 39 +; RUN: llvm-as < %s | llc -march=x86 -stats |& grep {Number of machine instrs printed} | grep 38 ; PR3495 +; The loop reversal kicks in once here, resulting in one fewer instruction. target triple = "i386-pc-linux-gnu" @x = external global [8 x i32], align 32 ; <[8 x i32]*> [#uses=1] |

