diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-06 14:22:52 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-06 14:22:52 +0000 |
commit | 8143a84c46b8d2fb58eddb46d84dd5d44d03cb6c (patch) | |
tree | 597092e9f340fae3b7c8e2d2c08dfb04f7801bd5 /test | |
parent | 7d9f51f4b5e594c9c72717888a68c0c8a2f1267b (diff) | |
download | external_llvm-8143a84c46b8d2fb58eddb46d84dd5d44d03cb6c.zip external_llvm-8143a84c46b8d2fb58eddb46d84dd5d44d03cb6c.tar.gz external_llvm-8143a84c46b8d2fb58eddb46d84dd5d44d03cb6c.tar.bz2 |
InstCombine: Turn _chk functions into the "unsafe" variant if length and max langth are equal.
This happens when we take the (non-constant) length from a malloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/objsize.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll index 9950e5f..4154ea0 100644 --- a/test/Transforms/InstCombine/objsize.ll +++ b/test/Transforms/InstCombine/objsize.ll @@ -176,3 +176,14 @@ define i32 @test9(i32 %x) { ; CHECK-NOT: ret i32 %x ret i32 %objsize } + +define i8* @test10(i32 %x) { +; CHECK: @test10 + %alloc = call noalias i8* @malloc(i32 %x) nounwind + %objsize = call i32 @llvm.objectsize.i32(i8* %alloc, i1 false) nounwind readonly + tail call i8* @__memset_chk(i8* %alloc, i32 0, i32 %x, i32 %objsize) nounwind +; CHECK-NOT: @llvm.objectsize +; CHECK: @llvm.memset + ret i8* %alloc +; CHECK: ret i8* +} |