[llvm] r302094 - strlen-1.ll: Fix test
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Wed May 3 16:32:52 PDT 2017
Author: matze
Date: Wed May 3 18:32:51 2017
New Revision: 302094
URL: http://llvm.org/viewvc/llvm-project?rev=302094&view=rev
Log:
strlen-1.ll: Fix test
Change test for `strlen(x) == 0 --> *x == 0` to actually test the
pattern.
Modified:
llvm/trunk/test/Transforms/InstCombine/strlen-1.ll
Modified: llvm/trunk/test/Transforms/InstCombine/strlen-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/strlen-1.ll?rev=302094&r1=302093&r2=302094&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/strlen-1.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/strlen-1.ll Wed May 3 18:32:51 2017
@@ -64,13 +64,14 @@ define i1 @test_simplify5() {
ret i1 %eq_hello
}
-define i1 @test_simplify6() {
+define i1 @test_simplify6(i8* %str_p) {
; CHECK-LABEL: @test_simplify6(
-; CHECK-NEXT: ret i1 true
+; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR_P:%.*]], align 1
+; CHECK-NEXT: [[EQ_NULL:%.*]] = icmp eq i8 [[STRLENFIRST]], 0
+; CHECK-NEXT: ret i1 [[EQ_NULL]]
;
- %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
- %null_l = call i32 @strlen(i8* %null_p)
- %eq_null = icmp eq i32 %null_l, 0
+ %str_l = call i32 @strlen(i8* %str_p)
+ %eq_null = icmp eq i32 %str_l, 0
ret i1 %eq_null
}
@@ -86,13 +87,14 @@ define i1 @test_simplify7() {
ret i1 %ne_hello
}
-define i1 @test_simplify8() {
+define i1 @test_simplify8(i8* %str_p) {
; CHECK-LABEL: @test_simplify8(
-; CHECK-NEXT: ret i1 false
+; CHECK-NEXT: [[STRLENFIRST:%.*]] = load i8, i8* [[STR_P:%.*]], align 1
+; CHECK-NEXT: [[NE_NULL:%.*]] = icmp ne i8 [[STRLENFIRST]], 0
+; CHECK-NEXT: ret i1 [[NE_NULL]]
;
- %null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
- %null_l = call i32 @strlen(i8* %null_p)
- %ne_null = icmp ne i32 %null_l, 0
+ %str_l = call i32 @strlen(i8* %str_p)
+ %ne_null = icmp ne i32 %str_l, 0
ret i1 %ne_null
}
More information about the llvm-commits
mailing list