diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-03-06 01:01:42 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-03-06 01:01:42 +0000 |
commit | fc8ccfedbba651e324d827de6693aad1491314c7 (patch) | |
tree | d77634f669eb929c346ffffd918ce0bc83bb21ab /test/Transforms/InstCombine | |
parent | e623050048e56a512e77c28b69925e7dc1efa6ad (diff) | |
download | llvm-fc8ccfedbba651e324d827de6693aad1491314c7.tar.gz llvm-fc8ccfedbba651e324d827de6693aad1491314c7.tar.bz2 llvm-fc8ccfedbba651e324d827de6693aad1491314c7.tar.xz |
Transform @llvm.objectsize to integer if the argument is a result of malloc of known size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/objsize.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll index bf1a37f975..8bbfa8fb7e 100644 --- a/test/Transforms/InstCombine/objsize.ll +++ b/test/Transforms/InstCombine/objsize.ll @@ -118,8 +118,24 @@ entry: ret i32 0 } +@s = external global i8* + +define void @test5(i32 %n) nounwind ssp { +; CHECK: @test5 +entry: + %0 = tail call noalias i8* @malloc(i32 20) nounwind + %1 = tail call i32 @llvm.objectsize.i32(i8* %0, i1 false) + %2 = load i8** @s, align 8 +; CHECK-NOT: @llvm.objectsize +; CHECK: @__memcpy_chk(i8* %0, i8* %1, i32 10, i32 20) + %3 = tail call i8* @__memcpy_chk(i8* %0, i8* %2, i32 10, i32 %1) nounwind + ret void +} + declare i8* @__memset_chk(i8*, i32, i64, i64) nounwind +declare noalias i8* @malloc(i32) nounwind + declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly declare i64 @llvm.objectsize.i64(i8*, i1) nounwind readonly |