[llvm] [DAG] Replace getValid*ShiftAmountConstant helpers with getValid*ShiftAmount helpers to support KnownBits analysis (PR #93182)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 24 09:24:50 PDT 2024
================
@@ -3020,91 +3020,111 @@ SelectionDAG::getValidShiftAmountConstant(SDValue V,
// Shifting more than the bitwidth is not valid.
const APInt &ShAmt = SA->getAPIntValue();
if (ShAmt.ult(BitWidth))
- return &ShAmt;
+ return ShAmt.getZExtValue();
+ } else {
+ KnownBits KnownAmt =
+ computeKnownBits(V.getOperand(1), DemandedElts, Depth + 1);
+ if (KnownAmt.isConstant() && KnownAmt.getConstant().ult(BitWidth))
----------------
goldsteinn wrote:
Okay, fair enough (maybe mention in a comment? This seems a bit non-intuitive).
https://github.com/llvm/llvm-project/pull/93182
More information about the llvm-commits
mailing list