[llvm] [DAG] canCreateUndefOrPoison - add handling for CTTZ/CTLZ nodes (PR #146361)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 30 08:54:31 PDT 2025
================
@@ -5618,6 +5620,14 @@ bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, const APInt &DemandedElts,
PoisonOnly, Depth + 1) ||
!getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1);
+ case ISD::CTTZ_ZERO_UNDEF:
+ case ISD::CTLZ_ZERO_UNDEF:
+ // If the amount is zero then the result will be poison.
+ // TODO: Add isKnownNeverZero DemandedElts handling.
+ return !isGuaranteedNotToBeUndefOrPoison(Op.getOperand(0), DemandedElts,
+ PoisonOnly, Depth + 1) ||
----------------
RKSimon wrote:
The shift case was to avoid a regression with #94265 / 9e22c7a0 - I think the need for both of these will go away after #94265 - so in the meantime I'm going to remove ZERO_UNDEF handling form this patch and deal with the cleanup later.
https://github.com/llvm/llvm-project/pull/146361
More information about the llvm-commits
mailing list