[InstCombine] remove 'tmp' names and regenerate checks; NFC

llvm-svn: 364546
This commit is contained in:
Sanjay Patel 2019-06-27 14:20:10 +00:00
parent 9318430237
commit d0e098696f
1 changed files with 64 additions and 63 deletions

View File

@ -1,35 +1,36 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s ; RUN: opt < %s -instcombine -S | FileCheck %s
;CHECK: @and_consts
;CHECK: and i32 %k, 12
;CHECK: icmp ne i32 %0, 12
;CHECK: ret
define i1 @and_consts(i32 %k, i32 %c1, i32 %c2) { define i1 @and_consts(i32 %k, i32 %c1, i32 %c2) {
bb: ; CHECK-LABEL: @and_consts(
%tmp1 = and i32 4, %k ; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K:%.*]], 12
%tmp2 = icmp eq i32 %tmp1, 0 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 12
%tmp5 = and i32 8, %k ; CHECK-NEXT: ret i1 [[TMP2]]
%tmp6 = icmp eq i32 %tmp5, 0 ;
%or = or i1 %tmp2, %tmp6 %t1 = and i32 4, %k
%t2 = icmp eq i32 %t1, 0
%t5 = and i32 8, %k
%t6 = icmp eq i32 %t5, 0
%or = or i1 %t2, %t6
ret i1 %or ret i1 %or
} }
;CHECK: @foo1_and
;CHECK: shl i32 1, %c1
;CHECK-NEXT: lshr i32 -2147483648, %c2
;CHECK-NEXT: or i32
;CHECK-NEXT: and i32
;CHECK-NEXT: icmp ne i32 %1, %0
;CHECK: ret
define i1 @foo1_and(i32 %k, i32 %c1, i32 %c2) { define i1 @foo1_and(i32 %k, i32 %c1, i32 %c2) {
bb: ; CHECK-LABEL: @foo1_and(
%tmp = shl i32 1, %c1 ; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]]
%tmp4 = lshr i32 -2147483648, %c2 ; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
%tmp1 = and i32 %tmp, %k ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]]
%tmp2 = icmp eq i32 %tmp1, 0 ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]]
%tmp5 = and i32 %tmp4, %k ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
%tmp6 = icmp eq i32 %tmp5, 0 ; CHECK-NEXT: ret i1 [[TMP3]]
%or = or i1 %tmp2, %tmp6 ;
%t = shl i32 1, %c1
%t4 = lshr i32 -2147483648, %c2
%t1 = and i32 %t, %k
%t2 = icmp eq i32 %t1, 0
%t5 = and i32 %t4, %k
%t6 = icmp eq i32 %t5, 0
%or = or i1 %t2, %t6
ret i1 %or ret i1 %or
} }
@ -37,21 +38,21 @@ bb:
define i1 @foo1_and_commuted(i32 %k, i32 %c1, i32 %c2) { define i1 @foo1_and_commuted(i32 %k, i32 %c1, i32 %c2) {
; CHECK-LABEL: @foo1_and_commuted( ; CHECK-LABEL: @foo1_and_commuted(
; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]] ; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]]
; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] ; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] ; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
; CHECK-NEXT: [[TMP0:%.*]] = or i32 [[TMP]], [[TMP4]] ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]]
; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K2]], [[TMP0]] ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]]
; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], [[TMP0]] ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]]
; CHECK-NEXT: ret i1 [[TMP2]] ; CHECK-NEXT: ret i1 [[TMP3]]
; ;
%k2 = mul i32 %k, %k ; to trick the complexity sorting %k2 = mul i32 %k, %k ; to trick the complexity sorting
%tmp = shl i32 1, %c1 %t = shl i32 1, %c1
%tmp4 = lshr i32 -2147483648, %c2 %t4 = lshr i32 -2147483648, %c2
%tmp1 = and i32 %k2, %tmp %t1 = and i32 %k2, %t
%tmp2 = icmp eq i32 %tmp1, 0 %t2 = icmp eq i32 %t1, 0
%tmp5 = and i32 %tmp4, %k2 %t5 = and i32 %t4, %k2
%tmp6 = icmp eq i32 %tmp5, 0 %t6 = icmp eq i32 %t5, 0
%or = or i1 %tmp2, %tmp6 %or = or i1 %t2, %t6
ret i1 %or ret i1 %or
} }
@ -61,30 +62,30 @@ define i1 @or_consts(i32 %k, i32 %c1, i32 %c2) {
; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 12 ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 12
; CHECK-NEXT: ret i1 [[TMP2]] ; CHECK-NEXT: ret i1 [[TMP2]]
; ;
%tmp1 = and i32 4, %k %t1 = and i32 4, %k
%tmp2 = icmp ne i32 %tmp1, 0 %t2 = icmp ne i32 %t1, 0
%tmp5 = and i32 8, %k %t5 = and i32 8, %k
%tmp6 = icmp ne i32 %tmp5, 0 %t6 = icmp ne i32 %t5, 0
%or = and i1 %tmp2, %tmp6 %or = and i1 %t2, %t6
ret i1 %or ret i1 %or
} }
define i1 @foo1_or(i32 %k, i32 %c1, i32 %c2) { define i1 @foo1_or(i32 %k, i32 %c1, i32 %c2) {
; CHECK-LABEL: @foo1_or( ; CHECK-LABEL: @foo1_or(
; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] ; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] ; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]] ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]]
; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]] ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]]
; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]] ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]]
; CHECK-NEXT: ret i1 [[TMP3]] ; CHECK-NEXT: ret i1 [[TMP3]]
; ;
%tmp = shl i32 1, %c1 %t = shl i32 1, %c1
%tmp4 = lshr i32 -2147483648, %c2 %t4 = lshr i32 -2147483648, %c2
%tmp1 = and i32 %tmp, %k %t1 = and i32 %t, %k
%tmp2 = icmp ne i32 %tmp1, 0 %t2 = icmp ne i32 %t1, 0
%tmp5 = and i32 %tmp4, %k %t5 = and i32 %t4, %k
%tmp6 = icmp ne i32 %tmp5, 0 %t6 = icmp ne i32 %t5, 0
%or = and i1 %tmp2, %tmp6 %or = and i1 %t2, %t6
ret i1 %or ret i1 %or
} }
@ -92,20 +93,20 @@ define i1 @foo1_or(i32 %k, i32 %c1, i32 %c2) {
define i1 @foo1_or_commuted(i32 %k, i32 %c1, i32 %c2) { define i1 @foo1_or_commuted(i32 %k, i32 %c1, i32 %c2) {
; CHECK-LABEL: @foo1_or_commuted( ; CHECK-LABEL: @foo1_or_commuted(
; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]] ; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]]
; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] ; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]]
; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] ; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]] ; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]]
; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]] ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]]
; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]] ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]]
; CHECK-NEXT: ret i1 [[TMP3]] ; CHECK-NEXT: ret i1 [[TMP3]]
; ;
%k2 = mul i32 %k, %k ; to trick the complexity sorting %k2 = mul i32 %k, %k ; to trick the complexity sorting
%tmp = shl i32 1, %c1 %t = shl i32 1, %c1
%tmp4 = lshr i32 -2147483648, %c2 %t4 = lshr i32 -2147483648, %c2
%tmp1 = and i32 %k2, %tmp %t1 = and i32 %k2, %t
%tmp2 = icmp ne i32 %tmp1, 0 %t2 = icmp ne i32 %t1, 0
%tmp5 = and i32 %tmp4, %k2 %t5 = and i32 %t4, %k2
%tmp6 = icmp ne i32 %tmp5, 0 %t6 = icmp ne i32 %t5, 0
%or = and i1 %tmp2, %tmp6 %or = and i1 %t2, %t6
ret i1 %or ret i1 %or
} }