diff options
author | Chris Lattner <sabre@nondot.org> | 2010-09-02 22:19:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-09-02 22:19:10 +0000 |
commit | 9c282011e6b7a6e23a3a163ec9c865890449e8dc (patch) | |
tree | b2ffd7467487e17780c735705641b081ce6c514a /test/Transforms/LICM | |
parent | 4caef6001d2180a707ab42f4986f9941d5d0248b (diff) | |
download | external_llvm-9c282011e6b7a6e23a3a163ec9c865890449e8dc.zip external_llvm-9c282011e6b7a6e23a3a163ec9c865890449e8dc.tar.gz external_llvm-9c282011e6b7a6e23a3a163ec9c865890449e8dc.tar.bz2 |
fix more AST updating bugs, correcting miscompilation in PR8041
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LICM')
-rw-r--r-- | test/Transforms/LICM/scalar_promote.ll | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Transforms/LICM/scalar_promote.ll b/test/Transforms/LICM/scalar_promote.ll index 6b103f3..c1d2b24 100644 --- a/test/Transforms/LICM/scalar_promote.ll +++ b/test/Transforms/LICM/scalar_promote.ll @@ -71,3 +71,50 @@ Out: ; preds = %Loop ret void } +; PR8041 +define void @test4(i8* %x, i8 %n) { +; CHECK: @test4 + %handle1 = alloca i8* + %handle2 = alloca i8* + store i8* %x, i8** %handle1 + br label %loop + +loop: + %tmp = getelementptr i8* %x, i64 8 + store i8* %tmp, i8** %handle2 + br label %subloop + +subloop: + %count = phi i8 [ 0, %loop ], [ %nextcount, %subloop ] + %offsetx2 = load i8** %handle2 + store i8 %n, i8* %offsetx2 + %newoffsetx2 = getelementptr i8* %offsetx2, i64 -1 + store i8* %newoffsetx2, i8** %handle2 + %nextcount = add i8 %count, 1 + %innerexitcond = icmp sge i8 %nextcount, 8 + br i1 %innerexitcond, label %innerexit, label %subloop + +; Should have promoted 'handle2' accesses. +; CHECK: subloop: +; CHECK-NEXT: phi i8* [ +; CHECK-NEXT: %count = phi i8 [ +; CHECK-NEXT: store i8 %n +; CHECK-NOT: store +; CHECK: br i1 + +innerexit: + %offsetx1 = load i8** %handle1 + %val = load i8* %offsetx1 + %cond = icmp eq i8 %val, %n + br i1 %cond, label %exit, label %loop + +; Should not have promoted offsetx1 loads. +; CHECK: innerexit: +; CHECK: %val = load i8* %offsetx1 +; CHECK: %cond = icmp eq i8 %val, %n +; CHECK: br i1 %cond, label %exit, label %loop + +exit: + ret void +} + |