llvm.org GIT mirror llvm / 09c10d8
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334322 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 1 year, 8 months ago
4 changed file(s) with 22 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
24582458 SDValue X = And.getOperand(0);
24592459 auto C = dyn_cast(And.getOperand(1));
24602460
2461 if (!C || !X->hasOneUse())
2461 if (!C)
24622462 return;
24632463 auto Range = getContiguousRangeOfSetBits(C->getAPIntValue());
24642464 if (!Range)
66 ; T2-NEXT: it
77 ; T1-NEXT: bmi
88 define i32 @single_bit(i32 %p) {
9 %a = and i32 %p, 256
10 %b = icmp eq i32 %a, 0
11 br i1 %b, label %true, label %false
12
13 true:
14 ret i32 1
15
16 false:
17 ret i32 2
18 }
19
20 ; CHECK-LABEL: single_bit_multi_use:
21 ; CHECK: lsls r0, r0, #23
22 ; T2-NEXT: mov
23 ; T2-NEXT: it
24 ; T1-NEXT: bmi
25 define i32 @single_bit_multi_use(i32 %p, i32* %z) {
26 store i32 %p, i32* %z
927 %a = and i32 %p, 256
1028 %b = icmp eq i32 %a, 0
1129 br i1 %b, label %true, label %false
77
88 ; CHECK-LABEL: foo:
99 ; CHECK: ldrb r[[R0:[0-9]+]], [r0]
10 ; CHECK: tst.w r[[R0]], #1
10 ; CHECK: lsls r{{[0-9]+}}, r[[R0]], #31
1111 define void @foo(i8* %call, double* %p) nounwind {
1212 entry:
1313 %tmp2 = load i8, i8* %call
645645 ; CHECK-NEXT: beq [[EXIT_LABEL:LBB[0-9_]+]]
646646 ; ENABLE: push {r4, lr}
647647
648 ; CHECK: tst r3, r4
648 ; CHECK: lsls r4, r3, #30
649649 ; ENABLE-NEXT: ldr [[POP:r[4567]]], [sp, #4]
650650 ; ENABLE-NEXT: mov lr, [[POP]]
651651 ; ENABLE-NEXT: pop {[[POP]]}
652652 ; ENABLE-NEXT: add sp, #4
653 ; CHECK-NEXT: beq [[EXIT_LABEL]]
653 ; CHECK-NEXT: bpl [[EXIT_LABEL]]
654654
655655 ; CHECK: str r1, [r2]
656656 ; CHECK: str r3, [r2]