[InstCombine] regenerate checks

utils/update_test_checks.py was improved with:
http://reviews.llvm.org/rL265414
to CHECK-NEXT the first line of the IR function. This ensures that nothing bad
has happened before that.

llvm-svn: 265417
This commit is contained in:
Sanjay Patel 2016-04-05 17:24:54 +00:00
parent 0484879fe7
commit 6ecf1b6760
10 changed files with 89 additions and 81 deletions

View File

@ -4,7 +4,7 @@
define <4 x float> @test(<4 x float> %tmp26, <4 x float> %tmp53) {
; (X+Y)-Y != X for fp vectors.
; CHECK-LABEL: @test(
; CHECK: [[TMP64:%.*]] = fadd <4 x float> %tmp26, %tmp53
; CHECK-NEXT: [[TMP64:%.*]] = fadd <4 x float> %tmp26, %tmp53
; CHECK-NEXT: [[TMP75:%.*]] = fsub <4 x float> [[TMP64]], %tmp53
; CHECK-NEXT: ret <4 x float> [[TMP75]]
;

View File

@ -3,56 +3,53 @@
define i32 @func1(i32 %a, i32 %b) {
; CHECK-LABEL: @func1(
; CHECK: [[TMP0:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP0]], %b
; CHECK-NEXT: ret i32 [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
entry:
%0 = or i32 %b, %a
%1 = and i32 %0, 1
%2 = and i32 %b, -2
%3 = or i32 %1, %2
ret i32 %3
%tmp = or i32 %b, %a
%tmp1 = and i32 %tmp, 1
%tmp2 = and i32 %b, -2
%tmp3 = or i32 %tmp1, %tmp2
ret i32 %tmp3
}
define i32 @func2(i32 %a, i32 %b) {
; CHECK-LABEL: @func2(
; CHECK: [[TMP0:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP0]], %b
; CHECK-NEXT: ret i32 [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
entry:
%0 = or i32 %a, %b
%1 = and i32 1, %0
%2 = and i32 -2, %b
%3 = or i32 %1, %2
ret i32 %3
%tmp = or i32 %a, %b
%tmp1 = and i32 1, %tmp
%tmp2 = and i32 -2, %b
%tmp3 = or i32 %tmp1, %tmp2
ret i32 %tmp3
}
define i32 @func3(i32 %a, i32 %b) {
; CHECK-LABEL: @func3(
; CHECK: [[TMP0:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP0]], %b
; CHECK-NEXT: ret i32 [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
entry:
%0 = or i32 %b, %a
%1 = and i32 %0, 1
%2 = and i32 %b, -2
%3 = or i32 %2, %1
ret i32 %3
%tmp = or i32 %b, %a
%tmp1 = and i32 %tmp, 1
%tmp2 = and i32 %b, -2
%tmp3 = or i32 %tmp2, %tmp1
ret i32 %tmp3
}
define i32 @func4(i32 %a, i32 %b) {
; CHECK-LABEL: @func4(
; CHECK: [[TMP0:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP0]], %b
; CHECK-NEXT: ret i32 [[TMP1]]
; CHECK-NEXT: [[TMP1:%.*]] = and i32 %a, 1
; CHECK-NEXT: [[TMP3:%.*]] = or i32 [[TMP1]], %b
; CHECK-NEXT: ret i32 [[TMP3]]
;
entry:
%0 = or i32 %a, %b
%1 = and i32 1, %0
%2 = and i32 -2, %b
%3 = or i32 %2, %1
ret i32 %3
%tmp = or i32 %a, %b
%tmp1 = and i32 1, %tmp
%tmp2 = and i32 -2, %b
%tmp3 = or i32 %tmp2, %tmp1
ret i32 %tmp3
}

View File

@ -7,25 +7,25 @@
; (x &z ) ^ (y & z) -> (x ^ y) & z
define i57 @test1(i57 %x, i57 %y, i57 %z) {
; CHECK-LABEL: @test1(
; CHECK: [[TMP61:%.*]] = xor i57 %x, %y
; CHECK-NEXT: [[TMP61:%.*]] = xor i57 %x, %y
; CHECK-NEXT: [[TMP7:%.*]] = and i57 [[TMP61]], %z
; CHECK-NEXT: ret i57 [[TMP7]]
;
%tmp3 = and i57 %z, %x
%tmp6 = and i57 %z, %y
%tmp7 = xor i57 %tmp3, %tmp6
ret i57 %tmp7
%tmp3 = and i57 %z, %x
%tmp6 = and i57 %z, %y
%tmp7 = xor i57 %tmp3, %tmp6
ret i57 %tmp7
}
; (x & y) ^ (x | y) -> x ^ y
define i23 @test2(i23 %x, i23 %y, i23 %z) {
; CHECK-LABEL: @test2(
; CHECK: [[TMP7:%.*]] = xor i23 %y, %x
; CHECK-NEXT: [[TMP7:%.*]] = xor i23 %y, %x
; CHECK-NEXT: ret i23 [[TMP7]]
;
%tmp3 = and i23 %y, %x
%tmp6 = or i23 %y, %x
%tmp7 = xor i23 %tmp3, %tmp6
ret i23 %tmp7
%tmp3 = and i23 %y, %x
%tmp6 = or i23 %y, %x
%tmp7 = xor i23 %tmp3, %tmp6
ret i23 %tmp7
}

View File

@ -3,7 +3,7 @@
define void @hang_2002-03-11(i32 %X) {
; CHECK-LABEL: @hang_2002-03-11(
; CHECK: ret void
; CHECK-NEXT: ret void
;
%reg117 = add i32 %X, 0
ret void
@ -14,7 +14,7 @@ define void @hang_2002-03-11(i32 %X) {
define i32 @sub_failure_2002-05-14(i32 %i, i32 %j) {
; CHECK-LABEL: @sub_failure_2002-05-14(
; CHECK: [[A:%.*]] = mul i32 %i, %j
; CHECK-NEXT: [[A:%.*]] = mul i32 %i, %j
; CHECK-NEXT: [[B:%.*]] = sub i32 2, [[A]]
; CHECK-NEXT: ret i32 [[B]]
;
@ -28,7 +28,7 @@ define i32 @sub_failure_2002-05-14(i32 %i, i32 %j) {
define i64 @cast_test_2002-08-02(i64 %A) {
; CHECK-LABEL: @cast_test_2002-08-02(
; CHECK: [[C2:%.*]] = and i64 %A, 255
; CHECK-NEXT: [[C2:%.*]] = and i64 %A, 255
; CHECK-NEXT: ret i64 [[C2]]
;
%c1 = trunc i64 %A to i8
@ -38,7 +38,7 @@ define i64 @cast_test_2002-08-02(i64 %A) {
define i32 @missed_const_prop_2002-12-05(i32 %A) {
; CHECK-LABEL: @missed_const_prop_2002-12-05(
; CHECK: ret i32 0
; CHECK-NEXT: ret i32 0
;
%A.neg = sub i32 0, %A
%.neg = sub i32 0, 1

View File

@ -3,7 +3,7 @@
define i32 @foo(i32 %x, i32 %y) {
; CHECK-LABEL: @foo(
; CHECK: [[A:%.*]] = and i32 %x, 7
; CHECK-NEXT: [[A:%.*]] = and i32 %x, 7
; CHECK-NEXT: [[B:%.*]] = and i32 %y, 7
; CHECK-NEXT: [[C:%.*]] = mul nuw nsw i32 [[A]], [[B]]
; CHECK-NEXT: [[D:%.*]] = shl nuw i32 [[C]], 26

View File

@ -6,12 +6,12 @@ target triple = "i386-apple-darwin9"
define <4 x float> @__inff4() nounwind readnone {
; CHECK-LABEL: @__inff4(
; CHECK: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x7FF0000000000000, float 0x7FF0000000000000>
; CHECK-NEXT: ret <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0x7FF0000000000000, float 0x7FF0000000000000>
;
%tmp14 = extractelement <1 x double> bitcast (<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000> to <1 x double>), i32 0
%tmp4 = bitcast double %tmp14 to i64
%tmp3 = bitcast i64 %tmp4 to <2 x float>
%tmp8 = shufflevector <2 x float> %tmp3, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%tmp9 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp8, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
ret <4 x float> %tmp9
%tmp14 = extractelement <1 x double> bitcast (<2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000> to <1 x double>), i32 0
%tmp4 = bitcast double %tmp14 to i64
%tmp3 = bitcast i64 %tmp4 to <2 x float>
%tmp8 = shufflevector <2 x float> %tmp3, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%tmp9 = shufflevector <4 x float> zeroinitializer, <4 x float> %tmp8, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
ret <4 x float> %tmp9
}

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by update_test_checks.py
; Test that the strlen library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
@ -17,93 +18,103 @@ declare i32 @strlen(i8*)
define i32 @test_simplify1() {
; CHECK-LABEL: @test_simplify1(
; CHECK-NEXT: ret i32 5
;
%hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
ret i32 %hello_l
; CHECK-NEXT: ret i32 5
}
define i32 @test_simplify2() {
; CHECK-LABEL: @test_simplify2(
; CHECK-NEXT: ret i32 0
;
%null_p = getelementptr [1 x i8], [1 x i8]* @null, i32 0, i32 0
%null_l = call i32 @strlen(i8* %null_p)
ret i32 %null_l
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify3() {
; CHECK-LABEL: @test_simplify3(
; CHECK-NEXT: ret i32 0
;
%null_hello_p = getelementptr [7 x i8], [7 x i8]* @null_hello, i32 0, i32 0
%null_hello_l = call i32 @strlen(i8* %null_hello_p)
ret i32 %null_hello_l
; CHECK-NEXT: ret i32 0
}
define i32 @test_simplify4() {
; CHECK-LABEL: @test_simplify4(
; CHECK-NEXT: ret i32 0
;
%len = tail call i32 @strlen(i8* @nullstring) nounwind
ret i32 %len
; CHECK-NEXT: ret i32 0
}
; Check strlen(x) == 0 --> *x == 0.
define i1 @test_simplify5() {
; CHECK-LABEL: @test_simplify5(
; CHECK-NEXT: ret i1 false
;
%hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%eq_hello = icmp eq i32 %hello_l, 0
ret i1 %eq_hello
; CHECK-NEXT: ret i1 false
}
define i1 @test_simplify6() {
; CHECK-LABEL: @test_simplify6(
; CHECK-NEXT: ret i1 true
;
%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
ret i1 %eq_null
; CHECK-NEXT: ret i1 true
}
; Check strlen(x) != 0 --> *x != 0.
define i1 @test_simplify7() {
; CHECK-LABEL: @test_simplify7(
; CHECK-NEXT: ret i1 true
;
%hello_p = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%hello_l = call i32 @strlen(i8* %hello_p)
%ne_hello = icmp ne i32 %hello_l, 0
ret i1 %ne_hello
; CHECK-NEXT: ret i1 true
}
define i1 @test_simplify8() {
; CHECK-LABEL: @test_simplify8(
; CHECK-NEXT: ret i1 false
;
%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
ret i1 %ne_null
; CHECK-NEXT: ret i1 false
}
define i32 @test_simplify9(i1 %x) {
; CHECK-LABEL: @test_simplify9
; CHECK-LABEL: @test_simplify9(
; CHECK-NEXT: [[TMP1:%.*]] = select i1 %x, i32 5, i32 6
; CHECK-NEXT: ret i32 [[TMP1]]
;
%hello = getelementptr [6 x i8], [6 x i8]* @hello, i32 0, i32 0
%longer = getelementptr [7 x i8], [7 x i8]* @longer, i32 0, i32 0
%s = select i1 %x, i8* %hello, i8* %longer
%l = call i32 @strlen(i8* %s)
; CHECK-NEXT: select i1 %x, i32 5, i32 6
ret i32 %l
; CHECK-NEXT: ret
}
; Check cases that shouldn't be simplified.
define i32 @test_no_simplify1() {
; CHECK-LABEL: @test_no_simplify1(
; CHECK-NEXT: [[A_L:%.*]] = call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @a, i32 0, i32 0))
; CHECK-NEXT: ret i32 [[A_L]]
;
%a_p = getelementptr [32 x i8], [32 x i8]* @a, i32 0, i32 0
%a_l = call i32 @strlen(i8* %a_p)
; CHECK-NEXT: %a_l = call i32 @strlen
ret i32 %a_l
; CHECK-NEXT: ret i32 %a_l
}

View File

@ -5,17 +5,18 @@
define void @self_assign_1() {
; CHECK-LABEL: @self_assign_1(
; CHECK: [[TMP:%.*]] = load volatile i32, i32* @x, align 4
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP:%.*]] = load volatile i32, i32* @x, align 4
; CHECK-NEXT: store volatile i32 [[TMP]], i32* @x, align 4
; CHECK-NEXT: br label %return
; CHECK: return:
; CHECK-NEXT: ret void
;
entry:
%tmp = load volatile i32, i32* @x
store volatile i32 %tmp, i32* @x
br label %return
%tmp = load volatile i32, i32* @x
store volatile i32 %tmp, i32* @x
br label %return
return:
ret void
ret void
}

View File

@ -5,7 +5,7 @@ declare double @abs(double)
define double @test(double %X) {
; CHECK-LABEL: @test(
; CHECK: [[Y:%.*]] = fadd double %X, 0.000000e+00
; CHECK-NEXT: [[Y:%.*]] = fadd double %X, 0.000000e+00
; CHECK-NEXT: ret double [[Y]]
;
%Y = fadd double %X, 0.0 ;; Should be a single add x, 0.0
@ -15,7 +15,7 @@ define double @test(double %X) {
define double @test1(double %X) {
; CHECK-LABEL: @test1(
; CHECK: [[Y:%.*]] = call double @abs(double %X)
; CHECK-NEXT: [[Y:%.*]] = call double @abs(double %X)
; CHECK-NEXT: ret double [[Y]]
;
%Y = call double @abs(double %X)

View File

@ -5,11 +5,10 @@
define i32 @test2(float %X, float %Y) {
; CHECK-LABEL: @test2(
; CHECK: [[TMP3:%.*]] = fcmp ord float %X, %Y
; CHECK-NEXT: [[TMP3:%.*]] = fcmp ord float %X, %Y
; CHECK-NEXT: [[TOBOOLNOT5:%.*]] = zext i1 [[TMP3]] to i32
; CHECK-NEXT: ret i32 [[TOBOOLNOT5]]
;
entry:
%tmp3 = fcmp uno float %X, %Y
%tmp34 = zext i1 %tmp3 to i8
%tmp = xor i8 %tmp34, 1