summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-12-31 13:52:36 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-12-31 13:52:36 +0000
commit7ab7c02d23d2bd00eb145c1ed561974e1841dea9 (patch)
treef1810822a55413eeb24d6e9e2831f99aa50f3eec /llvm/test/Transforms
parentf50ea7109d843492a1d6b0b20ad2acf4fcf2229b (diff)
downloadbcm5719-llvm-7ab7c02d23d2bd00eb145c1ed561974e1841dea9.tar.gz
bcm5719-llvm-7ab7c02d23d2bd00eb145c1ed561974e1841dea9.zip
add support for PHI nodes to ObjectSizeOffsetVisitor
llvm-svn: 171298
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/objsize.ll54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/objsize.ll b/llvm/test/Transforms/InstCombine/objsize.ll
index 31a3cb46e45..de8ac97b6f5 100644
--- a/llvm/test/Transforms/InstCombine/objsize.ll
+++ b/llvm/test/Transforms/InstCombine/objsize.ll
@@ -256,3 +256,57 @@ xpto:
return:
ret i32 7
}
+
+declare noalias i8* @valloc(i32) nounwind
+
+; CHECK: @test14
+; CHECK: ret i32 6
+define i32 @test14(i32 %a) nounwind {
+ switch i32 %a, label %sw.default [
+ i32 1, label %sw.bb
+ i32 2, label %sw.bb1
+ ]
+
+sw.bb:
+ %call = tail call noalias i8* @malloc(i32 6) nounwind
+ br label %sw.epilog
+
+sw.bb1:
+ %call2 = tail call noalias i8* @calloc(i32 3, i32 2) nounwind
+ br label %sw.epilog
+
+sw.default:
+ %call3 = tail call noalias i8* @valloc(i32 6) nounwind
+ br label %sw.epilog
+
+sw.epilog:
+ %b.0 = phi i8* [ %call3, %sw.default ], [ %call2, %sw.bb1 ], [ %call, %sw.bb ]
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %b.0, i1 false)
+ ret i32 %1
+}
+
+; CHECK: @test15
+; CHECK: llvm.objectsize
+define i32 @test15(i32 %a) nounwind {
+ switch i32 %a, label %sw.default [
+ i32 1, label %sw.bb
+ i32 2, label %sw.bb1
+ ]
+
+sw.bb:
+ %call = tail call noalias i8* @malloc(i32 3) nounwind
+ br label %sw.epilog
+
+sw.bb1:
+ %call2 = tail call noalias i8* @calloc(i32 2, i32 1) nounwind
+ br label %sw.epilog
+
+sw.default:
+ %call3 = tail call noalias i8* @valloc(i32 3) nounwind
+ br label %sw.epilog
+
+sw.epilog:
+ %b.0 = phi i8* [ %call3, %sw.default ], [ %call2, %sw.bb1 ], [ %call, %sw.bb ]
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %b.0, i1 false)
+ ret i32 %1
+}
OpenPOWER on IntegriCloud