[llvm] 66a163f - [DAG] GetDemandedBits - remove custom AND handling.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 04:56:14 PDT 2020
Author: Simon Pilgrim
Date: 2020-08-07T12:55:47+01:00
New Revision: 66a163f32817faa63e3717eb8ff1fe4188626c75
URL: https://github.com/llvm/llvm-project/commit/66a163f32817faa63e3717eb8ff1fe4188626c75
DIFF: https://github.com/llvm/llvm-project/commit/66a163f32817faa63e3717eb8ff1fe4188626c75.diff
LOG: [DAG] GetDemandedBits - remove custom AND handling.
As mentioned on D85463, we should be using SimplifyMultipleUseDemandedBits (which is the default fallback).
The minor regression in illegal-bitfield-loadstore.ll will be addressed properly by D77804.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/ARM/illegal-bitfield-loadstore.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index e20e9055af94..04767a7ce37d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -2248,18 +2248,6 @@ SDValue SelectionDAG::GetDemandedBits(SDValue V, const APInt &DemandedBits,
V.getOperand(1));
}
break;
- case ISD::AND: {
- // X & -1 -> X (ignoring bits which aren't demanded).
- // Also handle the case where masked out bits in X are known to be zero.
- if (ConstantSDNode *RHSC = isConstOrConstSplat(V.getOperand(1))) {
- const APInt &AndVal = RHSC->getAPIntValue();
- if (DemandedBits.isSubsetOf(AndVal) ||
- DemandedBits.isSubsetOf(computeKnownBits(V.getOperand(0)).Zero |
- AndVal))
- return V.getOperand(0);
- }
- break;
- }
}
return SDValue();
}
diff --git a/llvm/test/CodeGen/ARM/illegal-bitfield-loadstore.ll b/llvm/test/CodeGen/ARM/illegal-bitfield-loadstore.ll
index 93ba3fbc8530..2922e0ed5423 100644
--- a/llvm/test/CodeGen/ARM/illegal-bitfield-loadstore.ll
+++ b/llvm/test/CodeGen/ARM/illegal-bitfield-loadstore.ll
@@ -122,11 +122,12 @@ define void @i56_and_or(i56* %a) {
; BE-LABEL: i56_and_or:
; BE: @ %bb.0:
; BE-NEXT: mov r1, r0
+; BE-NEXT: mov r2, #128
+; BE-NEXT: ldrh r12, [r1, #4]!
+; BE-NEXT: ldrb r3, [r1, #2]
+; BE-NEXT: strb r2, [r1, #2]
+; BE-NEXT: orr r2, r3, r12, lsl #8
; BE-NEXT: ldr r12, [r0]
-; BE-NEXT: ldrh r2, [r1, #4]!
-; BE-NEXT: mov r3, #128
-; BE-NEXT: strb r3, [r1, #2]
-; BE-NEXT: lsl r2, r2, #8
; BE-NEXT: orr r2, r2, r12, lsl #24
; BE-NEXT: orr r2, r2, #384
; BE-NEXT: lsr r3, r2, #8
More information about the llvm-commits
mailing list