From d0e098696f940842146c70bc0f7bf8a41beb46a8 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 27 Jun 2019 14:20:10 +0000 Subject: [PATCH] [InstCombine] remove 'tmp' names and regenerate checks; NFC llvm-svn: 364546 --- .../Transforms/InstCombine/onehot_merge.ll | 127 +++++++++--------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/llvm/test/Transforms/InstCombine/onehot_merge.ll b/llvm/test/Transforms/InstCombine/onehot_merge.ll index 47a4ca4b628b..5fb23d57fe8b 100644 --- a/llvm/test/Transforms/InstCombine/onehot_merge.ll +++ b/llvm/test/Transforms/InstCombine/onehot_merge.ll @@ -1,35 +1,36 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; 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) { -bb: - %tmp1 = and i32 4, %k - %tmp2 = icmp eq i32 %tmp1, 0 - %tmp5 = and i32 8, %k - %tmp6 = icmp eq i32 %tmp5, 0 - %or = or i1 %tmp2, %tmp6 +; CHECK-LABEL: @and_consts( +; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K:%.*]], 12 +; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 12 +; CHECK-NEXT: ret i1 [[TMP2]] +; + %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 } -;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) { -bb: - %tmp = shl i32 1, %c1 - %tmp4 = lshr i32 -2147483648, %c2 - %tmp1 = and i32 %tmp, %k - %tmp2 = icmp eq i32 %tmp1, 0 - %tmp5 = and i32 %tmp4, %k - %tmp6 = icmp eq i32 %tmp5, 0 - %or = or i1 %tmp2, %tmp6 +; CHECK-LABEL: @foo1_and( +; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]] +; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]] +; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]] +; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret i1 [[TMP3]] +; + %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 } @@ -37,21 +38,21 @@ bb: define i1 @foo1_and_commuted(i32 %k, i32 %c1, i32 %c2) { ; CHECK-LABEL: @foo1_and_commuted( ; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]] -; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] -; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] -; CHECK-NEXT: [[TMP0:%.*]] = or i32 [[TMP]], [[TMP4]] -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K2]], [[TMP0]] -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], [[TMP0]] -; CHECK-NEXT: ret i1 [[TMP2]] +; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]] +; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]] +; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]] +; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret i1 [[TMP3]] ; %k2 = mul i32 %k, %k ; to trick the complexity sorting - %tmp = shl i32 1, %c1 - %tmp4 = lshr i32 -2147483648, %c2 - %tmp1 = and i32 %k2, %tmp - %tmp2 = icmp eq i32 %tmp1, 0 - %tmp5 = and i32 %tmp4, %k2 - %tmp6 = icmp eq i32 %tmp5, 0 - %or = or i1 %tmp2, %tmp6 + %t = shl i32 1, %c1 + %t4 = lshr i32 -2147483648, %c2 + %t1 = and i32 %k2, %t + %t2 = icmp eq i32 %t1, 0 + %t5 = and i32 %t4, %k2 + %t6 = icmp eq i32 %t5, 0 + %or = or i1 %t2, %t6 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: ret i1 [[TMP2]] ; - %tmp1 = and i32 4, %k - %tmp2 = icmp ne i32 %tmp1, 0 - %tmp5 = and i32 8, %k - %tmp6 = icmp ne i32 %tmp5, 0 - %or = and i1 %tmp2, %tmp6 + %t1 = and i32 4, %k + %t2 = icmp ne i32 %t1, 0 + %t5 = and i32 8, %k + %t6 = icmp ne i32 %t5, 0 + %or = and i1 %t2, %t6 ret i1 %or } define i1 @foo1_or(i32 %k, i32 %c1, i32 %c2) { ; CHECK-LABEL: @foo1_or( -; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] -; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]] +; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]] +; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]] ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[TMP1]], [[K:%.*]] ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP3]] ; - %tmp = shl i32 1, %c1 - %tmp4 = lshr i32 -2147483648, %c2 - %tmp1 = and i32 %tmp, %k - %tmp2 = icmp ne i32 %tmp1, 0 - %tmp5 = and i32 %tmp4, %k - %tmp6 = icmp ne i32 %tmp5, 0 - %or = and i1 %tmp2, %tmp6 + %t = shl i32 1, %c1 + %t4 = lshr i32 -2147483648, %c2 + %t1 = and i32 %t, %k + %t2 = icmp ne i32 %t1, 0 + %t5 = and i32 %t4, %k + %t6 = icmp ne i32 %t5, 0 + %or = and i1 %t2, %t6 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) { ; CHECK-LABEL: @foo1_or_commuted( ; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]] -; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]] -; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] -; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[TMP]], [[TMP4]] +; CHECK-NEXT: [[T:%.*]] = shl i32 1, [[C1:%.*]] +; CHECK-NEXT: [[T4:%.*]] = lshr i32 -2147483648, [[C2:%.*]] +; CHECK-NEXT: [[TMP1:%.*]] = or i32 [[T]], [[T4]] ; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[K2]], [[TMP1]] ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], [[TMP1]] ; CHECK-NEXT: ret i1 [[TMP3]] ; %k2 = mul i32 %k, %k ; to trick the complexity sorting - %tmp = shl i32 1, %c1 - %tmp4 = lshr i32 -2147483648, %c2 - %tmp1 = and i32 %k2, %tmp - %tmp2 = icmp ne i32 %tmp1, 0 - %tmp5 = and i32 %tmp4, %k2 - %tmp6 = icmp ne i32 %tmp5, 0 - %or = and i1 %tmp2, %tmp6 + %t = shl i32 1, %c1 + %t4 = lshr i32 -2147483648, %c2 + %t1 = and i32 %k2, %t + %t2 = icmp ne i32 %t1, 0 + %t5 = and i32 %t4, %k2 + %t6 = icmp ne i32 %t5, 0 + %or = and i1 %t2, %t6 ret i1 %or }