[llvm] e82d49b - [DAG] SimplifyMultipleUseDemandedBits - early-out for any scalable vector types
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 24 04:59:59 PDT 2022
Author: Simon Pilgrim
Date: 2022-07-24T12:59:43+01:00
New Revision: e82d49bfed3879fcf3d79a9978135fe5fabc9843
URL: https://github.com/llvm/llvm-project/commit/e82d49bfed3879fcf3d79a9978135fe5fabc9843
DIFF: https://github.com/llvm/llvm-project/commit/e82d49bfed3879fcf3d79a9978135fe5fabc9843.diff
LOG: [DAG] SimplifyMultipleUseDemandedBits - early-out for any scalable vector types
Noticed while working to remove SelectionDAG::GetDemandedBits - we were relying on the callers to have already bailed for scalable vectors
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index cd4f0ae42bcd..6205e74837c0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -654,6 +654,14 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op, const APInt &DemandedBits,
SDValue TargetLowering::SimplifyMultipleUseDemandedBits(
SDValue Op, const APInt &DemandedBits, const APInt &DemandedElts,
SelectionDAG &DAG, unsigned Depth) const {
+ EVT VT = Op.getValueType();
+
+ // Pretend we don't know anything about scalable vectors for now.
+ // TODO: We can probably do more work on simplifying the operations for
+ // scalable vectors, but for now we just bail out.
+ if (VT.isScalableVector())
+ return SDValue();
+
// Limit search depth.
if (Depth >= SelectionDAG::MaxRecursionDepth)
return SDValue();
@@ -664,7 +672,7 @@ SDValue TargetLowering::SimplifyMultipleUseDemandedBits(
// Not demanding any bits/elts from Op.
if (DemandedBits == 0 || DemandedElts == 0)
- return DAG.getUNDEF(Op.getValueType());
+ return DAG.getUNDEF(VT);
bool IsLE = DAG.getDataLayout().isLittleEndian();
unsigned NumElts = DemandedElts.getBitWidth();
@@ -894,6 +902,13 @@ SDValue TargetLowering::SimplifyMultipleUseDemandedBits(
SDValue Op, const APInt &DemandedBits, SelectionDAG &DAG,
unsigned Depth) const {
EVT VT = Op.getValueType();
+
+ // Pretend we don't know anything about scalable vectors for now.
+ // TODO: We can probably do more work on simplifying the operations for
+ // scalable vectors, but for now we just bail out.
+ if (VT.isScalableVector())
+ return SDValue();
+
APInt DemandedElts = VT.isVector()
? APInt::getAllOnes(VT.getVectorNumElements())
: APInt(1, 1);
More information about the llvm-commits
mailing list