summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/phi.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 19:50:13 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 19:50:13 +0000
commit0b40a8bc0e8a5822f43266d5e2030fc6220f9752 (patch)
tree9839709c23a69bf7f2f0092090496ffb378f82eb /llvm/test/Transforms/InstCombine/phi.ll
parent2805f116f65ad7149fd21780fb3c122d7391ecdf (diff)
downloadbcm5719-llvm-0b40a8bc0e8a5822f43266d5e2030fc6220f9752.tar.gz
bcm5719-llvm-0b40a8bc0e8a5822f43266d5e2030fc6220f9752.zip
fix a bug noticed by inspection: when instcombine sinks loads through
phis, it didn't preserve the alignment of the load. This is a missed optimization of the alignment is high and a miscompilation when the alignment is low. llvm-svn: 85736
Diffstat (limited to 'llvm/test/Transforms/InstCombine/phi.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/phi.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/phi.ll b/llvm/test/Transforms/InstCombine/phi.ll
index a5a535c6acf..08d28b4de7e 100644
--- a/llvm/test/Transforms/InstCombine/phi.ll
+++ b/llvm/test/Transforms/InstCombine/phi.ll
@@ -141,4 +141,25 @@ BB2:
; CHECK-NEXT: ret i32* %B
}
+define i32 @test9(i32* %A, i32* %B) {
+entry:
+ %c = icmp eq i32* %A, null
+ br i1 %c, label %bb1, label %bb
+
+bb:
+ %C = load i32* %B, align 1
+ br label %bb2
+
+bb1:
+ %D = load i32* %A, align 1
+ br label %bb2
+
+bb2:
+ %E = phi i32 [ %C, %bb ], [ %D, %bb1 ]
+ ret i32 %E
+; CHECK: bb2:
+; CHECK-NEXT: phi i32* [ %B, %bb ], [ %A, %bb1 ]
+; CHECK-NEXT: %E = load i32* %{{[^,]*}}, align 1
+; CHECK-NEXT: ret i32 %E
+}
OpenPOWER on IntegriCloud