diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-06 13:07:49 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-01-06 13:07:49 +0000 |
commit | a76cc117e0c129cc9e2b9b52f8327b295cc8ad3f (patch) | |
tree | a57e0362d13eee919b93f8153acb938c331cc745 /llvm/test/Transforms/InstCombine/objsize.ll | |
parent | 3aa955e906f207ddb12e26d8ef44152e571c1233 (diff) | |
download | bcm5719-llvm-a76cc117e0c129cc9e2b9b52f8327b295cc8ad3f.tar.gz bcm5719-llvm-a76cc117e0c129cc9e2b9b52f8327b295cc8ad3f.zip |
InstCombine: Teach llvm.objectsize folding to look through GEPs.
llvm-svn: 122958
Diffstat (limited to 'llvm/test/Transforms/InstCombine/objsize.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/objsize.ll | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/objsize.ll b/llvm/test/Transforms/InstCombine/objsize.ll index 664701bf211..043525b7555 100644 --- a/llvm/test/Transforms/InstCombine/objsize.ll +++ b/llvm/test/Transforms/InstCombine/objsize.ll @@ -150,3 +150,13 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind declare noalias i8* @malloc(i32) nounwind declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly + +define i32 @test7() { +; CHECK: @test7 + %alloc = call noalias i8* @malloc(i32 48) nounwind + %gep = getelementptr inbounds i8* %alloc, i32 16 + %objsize = call i32 @llvm.objectsize.i32(i8* %gep, i1 false) nounwind readonly +; CHECK-NEXT: ret i32 32 + ret i32 %objsize +} + |