aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-01-06 13:07:49 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-01-06 13:07:49 +0000
commit783a5c2b695015a5a2dfc48ee28b9936d0077542 (patch)
tree722d8305c83f0744e1f1faf39139e0d8a10abd3f /test/Transforms/InstCombine
parent5191e7cc26aa58e2f1a618187216e40965711aed (diff)
downloadexternal_llvm-783a5c2b695015a5a2dfc48ee28b9936d0077542.zip
external_llvm-783a5c2b695015a5a2dfc48ee28b9936d0077542.tar.gz
external_llvm-783a5c2b695015a5a2dfc48ee28b9936d0077542.tar.bz2
InstCombine: Teach llvm.objectsize folding to look through GEPs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122958 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/objsize.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll
index 664701b..043525b 100644
--- a/test/Transforms/InstCombine/objsize.ll
+++ b/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
+}
+