[llvm] r364433 - [NFC][InstCombine] Revisit one-use tests in shift-amount-reassociation-in-bittest.ll

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 07:42:40 PDT 2019


Author: lebedevri
Date: Wed Jun 26 07:42:39 2019
New Revision: 364433

URL: http://llvm.org/viewvc/llvm-project?rev=364433&view=rev
Log:
[NFC][InstCombine] Revisit one-use tests in shift-amount-reassociation-in-bittest.ll

Modified:
    llvm/trunk/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll

Modified: llvm/trunk/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll?rev=364433&r1=364432&r2=364433&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll Wed Jun 26 07:42:39 2019
@@ -260,22 +260,72 @@ declare void @use32(i32)
 define i1 @t16_const_oneuse0(i32 %x, i32 %y) {
 ; CHECK-LABEL: @t16_const_oneuse0(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
+; CHECK-NEXT:    call void @use32(i32 [[T0]])
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
 ; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
-; CHECK-NEXT:    call void @use32(i32 [[T2]])
 ; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
 ; CHECK-NEXT:    ret i1 [[T3]]
 ;
   %t0 = lshr i32 %x, 1
+  call void @use32(i32 %t0)
   %t1 = shl i32 %y, 1
   %t2 = and i32 %t1, %t0
-  call void @use32(i32 %t2)
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
 define i1 @t17_const_oneuse1(i32 %x, i32 %y) {
 ; CHECK-LABEL: @t17_const_oneuse1(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
+; CHECK-NEXT:    call void @use32(i32 [[T1]])
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, 1
+  %t1 = shl i32 %y, 1
+  call void @use32(i32 %t1)
+  %t2 = and i32 %t1, %t0
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t18_const_oneuse2(i32 %x, i32 %y) {
+; CHECK-LABEL: @t18_const_oneuse2(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    call void @use32(i32 [[T2]])
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, 1
+  %t1 = shl i32 %y, 1
+  %t2 = and i32 %t1, %t0
+  call void @use32(i32 %t2)
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t19_const_oneuse3(i32 %x, i32 %y) {
+; CHECK-LABEL: @t19_const_oneuse3(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
+; CHECK-NEXT:    call void @use32(i32 [[T0]])
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
+; CHECK-NEXT:    call void @use32(i32 [[T1]])
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, 1
+  call void @use32(i32 %t0)
+  %t1 = shl i32 %y, 1
+  call void @use32(i32 %t1)
+  %t2 = and i32 %t1, %t0
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t20_const_oneuse4(i32 %x, i32 %y) {
+; CHECK-LABEL: @t20_const_oneuse4(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
 ; CHECK-NEXT:    call void @use32(i32 [[T0]])
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
 ; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
@@ -291,8 +341,8 @@ define i1 @t17_const_oneuse1(i32 %x, i32
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
-define i1 @t18_const_oneuse2(i32 %x, i32 %y) {
-; CHECK-LABEL: @t18_const_oneuse2(
+define i1 @t21_const_oneuse5(i32 %x, i32 %y) {
+; CHECK-LABEL: @t21_const_oneuse5(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
 ; CHECK-NEXT:    call void @use32(i32 [[T1]])
@@ -309,8 +359,8 @@ define i1 @t18_const_oneuse2(i32 %x, i32
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
-define i1 @t19_const_oneuse2(i32 %x, i32 %y) {
-; CHECK-LABEL: @t19_const_oneuse2(
+define i1 @t22_const_oneuse6(i32 %x, i32 %y) {
+; CHECK-LABEL: @t22_const_oneuse6(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], 1
 ; CHECK-NEXT:    call void @use32(i32 [[T0]])
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], 1
@@ -330,8 +380,40 @@ define i1 @t19_const_oneuse2(i32 %x, i32
   ret i1 %t3
 }
 
-define i1 @t17_variable_oneuse0(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
-; CHECK-LABEL: @t17_variable_oneuse0(
+define i1 @t23_var_oneuse0(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t23_var_oneuse0(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
+; CHECK-NEXT:    call void @use32(i32 [[T0]])
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, %shamt0
+  call void @use32(i32 %t0)
+  %t1 = shl i32 %y, %shamt1
+  %t2 = and i32 %t1, %t0
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t24_var_oneuse1(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t24_var_oneuse1(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
+; CHECK-NEXT:    call void @use32(i32 [[T1]])
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, %shamt0
+  %t1 = shl i32 %y, %shamt1
+  call void @use32(i32 %t1)
+  %t2 = and i32 %t1, %t0
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t25_var_oneuse2(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t25_var_oneuse2(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
 ; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
@@ -346,8 +428,26 @@ define i1 @t17_variable_oneuse0(i32 %x,
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
-define i1 @t18_variable_oneuse1(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
-; CHECK-LABEL: @t18_variable_oneuse1(
+define i1 @t26_var_oneuse3(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t26_var_oneuse3(
+; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
+; CHECK-NEXT:    call void @use32(i32 [[T0]])
+; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
+; CHECK-NEXT:    call void @use32(i32 [[T1]])
+; CHECK-NEXT:    [[T2:%.*]] = and i32 [[T1]], [[T0]]
+; CHECK-NEXT:    [[T3:%.*]] = icmp ne i32 [[T2]], 0
+; CHECK-NEXT:    ret i1 [[T3]]
+;
+  %t0 = lshr i32 %x, %shamt0
+  call void @use32(i32 %t0)
+  %t1 = shl i32 %y, %shamt1
+  call void @use32(i32 %t1)
+  %t2 = and i32 %t1, %t0
+  %t3 = icmp ne i32 %t2, 0
+  ret i1 %t3
+}
+define i1 @t27_var_oneuse4(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t27_var_oneuse4(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
 ; CHECK-NEXT:    call void @use32(i32 [[T0]])
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
@@ -364,8 +464,8 @@ define i1 @t18_variable_oneuse1(i32 %x,
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
-define i1 @t19_variable_oneuse2(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
-; CHECK-LABEL: @t19_variable_oneuse2(
+define i1 @t28_var_oneuse5(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t28_var_oneuse5(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]
 ; CHECK-NEXT:    call void @use32(i32 [[T1]])
@@ -382,8 +482,8 @@ define i1 @t19_variable_oneuse2(i32 %x,
   %t3 = icmp ne i32 %t2, 0
   ret i1 %t3
 }
-define i1 @t20_variable_oneuse2(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
-; CHECK-LABEL: @t20_variable_oneuse2(
+define i1 @t29_var_oneuse6(i32 %x, i32 %y, i32 %shamt0, i32 %shamt1) {
+; CHECK-LABEL: @t29_var_oneuse6(
 ; CHECK-NEXT:    [[T0:%.*]] = lshr i32 [[X:%.*]], [[SHAMT0:%.*]]
 ; CHECK-NEXT:    call void @use32(i32 [[T0]])
 ; CHECK-NEXT:    [[T1:%.*]] = shl i32 [[Y:%.*]], [[SHAMT1:%.*]]




More information about the llvm-commits mailing list