Skip to content

Commit

Permalink
[X86] getTargetShuffleInputs - ensure we limit the maximum recursion …
Browse files Browse the repository at this point in the history
…depth to match SelectionDAG::MaxRecursionDepth

Regressions were pre-handled by rG62e36b120749

Fixes Issue #52960
  • Loading branch information
RKSimon committed Jan 18, 2022
1 parent d7c19f9 commit ce2345d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -7922,6 +7922,7 @@ static bool getTargetShuffleInputs(SDValue Op, SmallVectorImpl<SDValue> &Inputs,
// Attempt to decode ops that could be represented as a shuffle mask.
// The decoded shuffle mask may contain a different number of elements to the
// destination value type.
// TODO: Merge into getTargetShuffleInputs()
static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
SmallVectorImpl<int> &Mask,
SmallVectorImpl<SDValue> &Ops,
Expand Down Expand Up @@ -8370,6 +8371,9 @@ static bool getTargetShuffleInputs(SDValue Op, const APInt &DemandedElts,
APInt &KnownUndef, APInt &KnownZero,
const SelectionDAG &DAG, unsigned Depth,
bool ResolveKnownElts) {
if (Depth >= SelectionDAG::MaxRecursionDepth)
return false; // Limit search depth.

EVT VT = Op.getValueType();
if (!VT.isSimple() || !VT.isVector())
return false;
Expand Down

0 comments on commit ce2345d

Please sign in to comment.