[llvm] r334322 - [ARM] Allow CMPZ transforms even if the input has multiple uses.
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 8 14:16:56 PDT 2018
Author: efriedma
Date: Fri Jun 8 14:16:56 2018
New Revision: 334322
URL: http://llvm.org/viewvc/llvm-project?rev=334322&view=rev
Log:
[ARM] Allow CMPZ transforms even if the input has multiple uses.
It looks like this got left in by accident in r289794; I can't think of
any reason this check would be necessary. (Maybe it was meant to be a
check that the AND has one use? But we check that a few lines earlier.)
Differential Revision: https://reviews.llvm.org/D47921
Modified:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/ARM/and-cmpz.ll
llvm/trunk/test/CodeGen/ARM/load_i1_select.ll
llvm/trunk/test/CodeGen/Thumb/thumb-shrink-wrapping.ll
Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=334322&r1=334321&r2=334322&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Fri Jun 8 14:16:56 2018
@@ -2459,7 +2459,7 @@ void ARMDAGToDAGISel::SelectCMPZ(SDNode
SDValue X = And.getOperand(0);
auto C = dyn_cast<ConstantSDNode>(And.getOperand(1));
- if (!C || !X->hasOneUse())
+ if (!C)
return;
auto Range = getContiguousRangeOfSetBits(C->getAPIntValue());
if (!Range)
Modified: llvm/trunk/test/CodeGen/ARM/and-cmpz.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/and-cmpz.ll?rev=334322&r1=334321&r2=334322&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/and-cmpz.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/and-cmpz.ll Fri Jun 8 14:16:56 2018
@@ -18,6 +18,24 @@ false:
ret i32 2
}
+; CHECK-LABEL: single_bit_multi_use:
+; CHECK: lsls r0, r0, #23
+; T2-NEXT: mov
+; T2-NEXT: it
+; T1-NEXT: bmi
+define i32 @single_bit_multi_use(i32 %p, i32* %z) {
+ store i32 %p, i32* %z
+ %a = and i32 %p, 256
+ %b = icmp eq i32 %a, 0
+ br i1 %b, label %true, label %false
+
+true:
+ ret i32 1
+
+false:
+ ret i32 2
+}
+
; CHECK-LABEL: multi_bit_lsb_ubfx:
; CHECK: lsls r0, r0, #24
; T2-NEXT: mov
Modified: llvm/trunk/test/CodeGen/ARM/load_i1_select.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/load_i1_select.ll?rev=334322&r1=334321&r2=334322&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/load_i1_select.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/load_i1_select.ll Fri Jun 8 14:16:56 2018
@@ -8,7 +8,7 @@ target triple = "thumbv7-apple-ios0.0.0"
; CHECK-LABEL: foo:
; CHECK: ldrb r[[R0:[0-9]+]], [r0]
-; CHECK: tst.w r[[R0]], #1
+; CHECK: lsls r{{[0-9]+}}, r[[R0]], #31
define void @foo(i8* %call, double* %p) nounwind {
entry:
%tmp2 = load i8, i8* %call
Modified: llvm/trunk/test/CodeGen/Thumb/thumb-shrink-wrapping.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb/thumb-shrink-wrapping.ll?rev=334322&r1=334321&r2=334322&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb/thumb-shrink-wrapping.ll (original)
+++ llvm/trunk/test/CodeGen/Thumb/thumb-shrink-wrapping.ll Fri Jun 8 14:16:56 2018
@@ -646,12 +646,12 @@ define i1 @beq_to_bx(i32* %y, i32 %head)
; CHECK-NEXT: beq [[EXIT_LABEL:LBB[0-9_]+]]
; ENABLE: push {r4, lr}
-; CHECK: tst r3, r4
+; CHECK: lsls r4, r3, #30
; ENABLE-NEXT: ldr [[POP:r[4567]]], [sp, #4]
; ENABLE-NEXT: mov lr, [[POP]]
; ENABLE-NEXT: pop {[[POP]]}
; ENABLE-NEXT: add sp, #4
-; CHECK-NEXT: beq [[EXIT_LABEL]]
+; CHECK-NEXT: bpl [[EXIT_LABEL]]
; CHECK: str r1, [r2]
; CHECK: str r3, [r2]
More information about the llvm-commits
mailing list