diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-28 16:56:46 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-28 16:56:46 +0000 |
commit | ab73c493ea1289dafeb1225cd0066410aa5c9ee0 (patch) | |
tree | cba40b68c057c2afe53563a6214dc5c564d5f8b1 /llvm/test/Transforms/SimplifyCFG/basictest.ll | |
parent | 6eca4eff1950ca9c39d3c41b798c94cf7d8208f7 (diff) | |
download | bcm5719-llvm-ab73c493ea1289dafeb1225cd0066410aa5c9ee0.tar.gz bcm5719-llvm-ab73c493ea1289dafeb1225cd0066410aa5c9ee0.zip |
Fix pr14893.
When simplifycfg moves an instruction, it must drop metadata it doesn't know
is still valid with the preconditions changes. In particular, it must drop
the range and tbaa metadata.
The patch implements this with an utility function to drop all metadata not
in a white list.
llvm-svn: 200322
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG/basictest.ll')
-rw-r--r-- | llvm/test/Transforms/SimplifyCFG/basictest.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/basictest.ll b/llvm/test/Transforms/SimplifyCFG/basictest.ll index 9c4edd68b80..d6958a9c111 100644 --- a/llvm/test/Transforms/SimplifyCFG/basictest.ll +++ b/llvm/test/Transforms/SimplifyCFG/basictest.ll @@ -41,3 +41,33 @@ return: ; preds = %entry ; CHECK-LABEL: @test5( ; CHECK-NEXT: ret void } + + +; PR14893 +define i8 @test6f() { +; CHECK-LABEL: @test6f +; CHECK: alloca i8, align 1 +; CHECK-NEXT: call i8 @test6g +; CHECK-NEXT: icmp eq i8 %tmp, 0 +; CHECK-NEXT: load i8* %r, align 1{{$}} + +bb0: + %r = alloca i8, align 1 + %tmp = call i8 @test6g(i8* %r) + %tmp1 = icmp eq i8 %tmp, 0 + br i1 %tmp1, label %bb2, label %bb1 +bb1: + %tmp3 = load i8* %r, align 1, !range !2, !tbaa !1 + %tmp4 = icmp eq i8 %tmp3, 1 + br i1 %tmp4, label %bb2, label %bb3 +bb2: + br label %bb3 +bb3: + %tmp6 = phi i8 [ 0, %bb2 ], [ 1, %bb1 ] + ret i8 %tmp6 +} +declare i8 @test6g(i8*) + +!0 = metadata !{metadata !1, metadata !1, i64 0} +!1 = metadata !{metadata !"foo"} +!2 = metadata !{i8 0, i8 2} |