diff options
| author | Andrew Trick <atrick@apple.com> | 2011-11-30 06:26:42 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2011-11-30 06:26:42 +0000 |
| commit | 613c67e4758095e9c12229fe329e4a7cc675e692 (patch) | |
| tree | 780fad758ef79dbb46f87518e129f476c14e6392 | |
| parent | bafd224c8bc7bde7dff918f3d9ca005d9d2e854f (diff) | |
| download | bcm5719-llvm-613c67e4758095e9c12229fe329e4a7cc675e692.tar.gz bcm5719-llvm-613c67e4758095e9c12229fe329e4a7cc675e692.zip | |
Better test case found in duplicate PR10570.
llvm-svn: 145484
| -rw-r--r-- | llvm/test/Transforms/LoopStrengthReduce/2011-11-29-postincphi.ll | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-11-29-postincphi.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-11-29-postincphi.ll index 3f9953e4724..cb23ad01a49 100644 --- a/llvm/test/Transforms/LoopStrengthReduce/2011-11-29-postincphi.ll +++ b/llvm/test/Transforms/LoopStrengthReduce/2011-11-29-postincphi.ll @@ -1,8 +1,8 @@ ; RUN: llc < %s | FileCheck %s ; ; PR11431: handle a phi operand that is replaced by a postinc user. -; LSR first expands %mul to %iv1 in %phi32 -; LSR then expands %iv1 in %phi32 into two decrements, one on each loop exit. +; LSR first expands %t3 to %t2 in %phi +; LSR then expands %t2 in %phi into two decrements, one on each loop exit. target datalayout = "e-p:64:64:64-S128-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-f128:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu" @@ -11,46 +11,26 @@ declare i1 @check() nounwind ; Check that LSR did something close to the behavior at the time of the bug. ; CHECK: @sqlite3DropTriggerPtr -; CHECK: addq $48, %rax -; CHECK: je -; CHECK: addq $-48, %rax +; CHECK: incq %rax +; CHECK: jne +; CHECK: decq %rax ; CHECK: ret -define i64 @sqlite3DropTriggerPtr() { -entry: - %cmp0 = call zeroext i1 @check() - br i1 %cmp0, label %"8", label %"3" - -"3": ; preds = %entry - br i1 %cmp0, label %"4", label %"8" - -"4": ; preds = %"3" - br i1 %cmp0, label %"8", label %"5.preheader" - -"5.preheader": ; preds = %"4" - br label %"5" - -"5": - %iv0 = phi i32 [ %iv0.inc, %"6" ], [ 0, %"5.preheader" ] - %iv1 = phi i64 [ %iv1.inc, %"6" ], [ 48, %"5.preheader" ] - %iv0.inc = add nsw i32 %iv0, 1 - %cmp = icmp eq i32 %iv0.inc, 0 - br i1 %cmp, label %"7", label %"6" - -"6": - %iv1.inc = add i64 %iv1, 48 - %iv1.ofs = add i64 %iv1, 40 - %ptr8 = getelementptr inbounds i8* undef, i64 %iv1.ofs - %ptr32 = bitcast i8* %ptr8 to i32** - %v = load i32** %ptr32, align 8 - br i1 %cmp0, label %"8", label %"5" - -"7": - %iv.inc64 = sext i32 %iv0.inc to i64 - %mul = mul i64 %iv.inc64, 48 - br label %"8" - -"8": ; preds = %"7", %"5", %"4", %"3", %entry - %phi32 = phi i32 [ %iv0.inc, %"7" ], [ 0, %"4" ], [ 0, %"3" ], [ -1000000, %entry ], [ %iv0.inc, %"6" ] - %phi64 = phi i64 [ %mul, %"7" ], [ 0, %"4" ], [ 0, %"3" ], [ -48000000, %entry ], [ %iv1, %"6" ] - ret i64 %phi64 +define i64 @sqlite3DropTriggerPtr() nounwind { +bb: + %cmp = call zeroext i1 @check() + br label %bb1 + +bb1: ; preds = %bb4, %bb + %t0 = phi i64 [ 0, %bb ], [ %t3, %bb4 ] + %t2 = phi i64 [ 1, %bb ], [ %t5, %bb4 ] + %t3 = add nsw i64 %t0, 1 + br i1 %cmp, label %bb4, label %bb8 + +bb4: ; preds = %bb1 + %t5 = add nsw i64 %t2, 1 + br i1 %cmp, label %bb1, label %bb8 + +bb8: ; preds = %bb8, %bb4 + %phi = phi i64 [ %t3, %bb1 ], [ %t2, %bb4 ] + ret i64 %phi } |

