aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-07-24 16:28:13 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-07-24 16:28:13 +0000
commit9827c8e1c96950d17a4dbb7ef9d9036501c40c1b (patch)
treeadc0338a9d54072cba27b1dd313a112dde05cfb0 /test/Transforms
parenta94d6e87c4c49f2e81b01d66d8bfb591277f8f96 (diff)
downloadexternal_llvm-9827c8e1c96950d17a4dbb7ef9d9036501c40c1b.zip
external_llvm-9827c8e1c96950d17a4dbb7ef9d9036501c40c1b.tar.gz
external_llvm-9827c8e1c96950d17a4dbb7ef9d9036501c40c1b.tar.bz2
teach objectsize about strdup() and strndup()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/objsize.ll48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll
index f5a4581..1818d89 100644
--- a/test/Transforms/InstCombine/objsize.ll
+++ b/test/Transforms/InstCombine/objsize.ll
@@ -171,3 +171,51 @@ define i32 @test8(i8** %esc) {
; CHECK: ret i32 30
ret i32 %objsize
}
+
+declare noalias i8* @strdup(i8* nocapture) nounwind
+declare noalias i8* @strndup(i8* nocapture, i32) nounwind
+
+; CHECK: @test9
+define i32 @test9(i8** %esc) {
+ %call = tail call i8* @strdup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0)) nounwind
+ store i8* %call, i8** %esc, align 8
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+; CHECK: ret i32 8
+ ret i32 %1
+}
+
+; CHECK: @test10
+define i32 @test10(i8** %esc) {
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 3) nounwind
+ store i8* %call, i8** %esc, align 8
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+; CHECK: ret i32 4
+ ret i32 %1
+}
+
+; CHECK: @test11
+define i32 @test11(i8** %esc) {
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 7) nounwind
+ store i8* %call, i8** %esc, align 8
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+; CHECK: ret i32 8
+ ret i32 %1
+}
+
+; CHECK: @test12
+define i32 @test12(i8** %esc) {
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 8) nounwind
+ store i8* %call, i8** %esc, align 8
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+; CHECK: ret i32 8
+ ret i32 %1
+}
+
+; CHECK: @test13
+define i32 @test13(i8** %esc) {
+ %call = tail call i8* @strndup(i8* getelementptr inbounds ([8 x i8]* @.str, i64 0, i64 0), i32 57) nounwind
+ store i8* %call, i8** %esc, align 8
+ %1 = tail call i32 @llvm.objectsize.i32(i8* %call, i1 true)
+; CHECK: ret i32 8
+ ret i32 %1
+}