diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-01 19:50:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-01 19:50:13 +0000 |
commit | e3c6281a98655cee3b8d870109c81fa4338fdf9d (patch) | |
tree | e5ae8edbbd3d20c205a7e5cb3686e8eae9ac989a /test/Transforms/InstCombine | |
parent | 3e54f8850a262fe0c8c7253b4e0ac700566c7365 (diff) | |
download | external_llvm-e3c6281a98655cee3b8d870109c81fa4338fdf9d.zip external_llvm-e3c6281a98655cee3b8d870109c81fa4338fdf9d.tar.gz external_llvm-e3c6281a98655cee3b8d870109c81fa4338fdf9d.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/phi.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index a5a535c..08d28b4 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/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 +} |