summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKai Nacke <kai.nacke@redstar.de>2014-02-04 05:55:16 +0000
committerKai Nacke <kai.nacke@redstar.de>2014-02-04 05:55:16 +0000
commit6840e895c1e77c5862c1d3f46747ae7f654476d4 (patch)
treeff4b5e582ef1ea3ba98415d60ffbc9d1246b80a1 /test
parenteabe14bd96c35fbb9b11288e9ee1785a64117896 (diff)
downloadllvm-6840e895c1e77c5862c1d3f46747ae7f654476d4.tar.gz
llvm-6840e895c1e77c5862c1d3f46747ae7f654476d4.tar.bz2
llvm-6840e895c1e77c5862c1d3f46747ae7f654476d4.tar.xz
Add strchr(p, 0) -> p + strlen(p) to SimplifyLibCalls
Add the missing transformation strchr(p, 0) -> p + strlen(p) to SimplifyLibCalls and remove the ToDo comment. Reviewer: Duncan P.N. Exan Smith git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/strchr-1.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/strchr-1.ll b/test/Transforms/InstCombine/strchr-1.ll
index d2c9894621..66b3e2e51c 100644
--- a/test/Transforms/InstCombine/strchr-1.ll
+++ b/test/Transforms/InstCombine/strchr-1.ll
@@ -63,3 +63,16 @@ define void @test_simplify5() {
store i8* %dst, i8** @chp
ret void
}
+
+; Check transformation strchr(p, 0) -> p + strlen(p)
+define void @test_simplify6(i8* %str) {
+; CHECK: %strlen = call i32 @strlen(i8* %str)
+; CHECK-NOT: call i8* @strchr
+; CHECK: %strchr = getelementptr i8* %str, i32 %strlen
+; CHECK: store i8* %strchr, i8** @chp, align 4
+; CHECK: ret void
+
+ %dst = call i8* @strchr(i8* %str, i32 0)
+ store i8* %dst, i8** @chp
+ ret void
+}