diff options
author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-31 13:52:36 +0000 |
---|---|---|
committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-12-31 13:52:36 +0000 |
commit | 729e602082beee6ce248f6ab7bfdf734fbcf0e37 (patch) | |
tree | 894c3d36af2333a0c6502afb030b3c60d1c2d6d1 /test | |
parent | 6931055232eb2836dfc3e6dc51f06cee80dadf4b (diff) | |
download | external_llvm-729e602082beee6ce248f6ab7bfdf734fbcf0e37.zip external_llvm-729e602082beee6ce248f6ab7bfdf734fbcf0e37.tar.gz external_llvm-729e602082beee6ce248f6ab7bfdf734fbcf0e37.tar.bz2 |
add support for PHI nodes to ObjectSizeOffsetVisitor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/objsize.ll | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll index 31a3cb4..de8ac97 100644 --- a/test/Transforms/InstCombine/objsize.ll +++ b/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 +} |