Skip to content

Commit 9e22c7a

Browse files
committed
[DAG] canCreateUndefOrPoison - only compute shift amount knownbits when not poison
Since #93182 we can now call computeKnownBits inside getValidMaximumShiftAmount to determine the bounds of the shift amount ensuring that it wasn't poison, meaning if we did freeze the ahift amount, isGuaranteedNotToBeUndefOrPoison would then fail as we can't call computeKnownBits through FREEZE for potentially poison values. I'm still reducing a decent test case but wanted to get the buildbot fix ASAP.
1 parent 2a1ea15 commit 9e22c7a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5283,8 +5283,11 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
52835283
case ISD::SHL:
52845284
case ISD::SRL:
52855285
case ISD::SRA:
5286-
// If the max shift amount isn't in range, then the shift can create poison.
5287-
return !getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
5286+
// If the max shift amount isn't in range, then the shift can
5287+
// create poison.
5288+
return !isGuaranteedNotToBeUndefOrPoison(Op.getOperand(1), DemandedElts,
5289+
Depth + 1) ||
5290+
!getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
52885291

52895292
case ISD::SCALAR_TO_VECTOR:
52905293
// Check if we demand any upper (undef) elements.

0 commit comments

Comments
 (0)