[llvm] 9e22c7a - [DAG] canCreateUndefOrPoison - only compute shift amount knownbits when not poison
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 1 11:05:48 PDT 2024
Author: Simon Pilgrim
Date: 2024-06-01T19:05:27+01:00
New Revision: 9e22c7a0ea87228dffcdfd7ab62724f72e0b3e30
URL: https://github.com/llvm/llvm-project/commit/9e22c7a0ea87228dffcdfd7ab62724f72e0b3e30
DIFF: https://github.com/llvm/llvm-project/commit/9e22c7a0ea87228dffcdfd7ab62724f72e0b3e30.diff
LOG: [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.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0ea33c1c699bf..3def51c49f3a3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5283,8 +5283,11 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
case ISD::SHL:
case ISD::SRL:
case ISD::SRA:
- // If the max shift amount isn't in range, then the shift can create poison.
- return !getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
+ // If the max shift amount isn't in range, then the shift can
+ // create poison.
+ return !isGuaranteedNotToBeUndefOrPoison(Op.getOperand(1), DemandedElts,
+ Depth + 1) ||
+ !getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
case ISD::SCALAR_TO_VECTOR:
// Check if we demand any upper (undef) elements.
More information about the llvm-commits
mailing list