diff options
| author | James Molloy <james.molloy@arm.com> | 2016-08-30 10:56:08 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2016-08-30 10:56:08 +0000 |
| commit | d13b1239e4e4c1a653d3b7549aff679892a7f727 (patch) | |
| tree | 2bde42a1c7b5468ae75e57a9ba44a5e08aed7da9 /llvm/test/Transforms/SimplifyCFG | |
| parent | 002572318938f74bb0177dd83d24a59b1cdd013d (diff) | |
| download | bcm5719-llvm-d13b1239e4e4c1a653d3b7549aff679892a7f727.tar.gz bcm5719-llvm-d13b1239e4e4c1a653d3b7549aff679892a7f727.zip | |
[SimplifyCFG] Properly CSE metadata in SinkThenElseCodeToEnd
This was missing, meaning the metadata in sunk instructions was potentially bogus and could cause miscompiles.
llvm-svn: 280072
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/sink-common-code.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll index d7d535fa0bc..e3a86dc9385 100644 --- a/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll +++ b/llvm/test/Transforms/SimplifyCFG/sink-common-code.ll @@ -310,3 +310,40 @@ declare i32 @llvm.cttz.i32(i32 %x) readnone ; CHECK: call i32 @llvm.ctlz ; CHECK: call i32 @llvm.cttz +; The TBAA metadata should be properly combined. +define i32 @test13(i1 zeroext %flag, i32 %x, i32* %y) { +entry: + br i1 %flag, label %if.then, label %if.else + +if.then: + %z = load volatile i32, i32* %y + %a = add i32 %z, 5 + store volatile i32 %a, i32* %y, !tbaa !3 + br label %if.end + +if.else: + %w = load volatile i32, i32* %y + %b = add i32 %w, 7 + store volatile i32 %b, i32* %y, !tbaa !4 + br label %if.end + +if.end: + ret i32 1 +} + +!0 = !{ !"an example type tree" } +!1 = !{ !"int", !0 } +!2 = !{ !"float", !0 } +!3 = !{ !"const float", !2, i64 0 } +!4 = !{ !"special float", !2, i64 1 } + +; CHECK-LABEL: test13 +; CHECK-DAG: select +; CHECK-DAG: load volatile +; CHECK: store volatile {{.*}}, !tbaa !0 +; CHECK-NOT: load +; CHECK-NOT: store + +; CHECK: !0 = !{!1, !1, i64 0} +; CHECK: !1 = !{!"float", !2} +; CHECK: !2 = !{!"an example type tree"}
\ No newline at end of file |

