[llvm] [AArch64] canCreateUndefOrPoisonForTargetNode - AArch64ISD::VASHR\VLSHR\VSHL can't create undef/poison (PR #156445)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 3 07:44:53 PDT 2025
RKSimon wrote:
> > OK - should I assert an inrange ConstantSDNode value or just assume it? I can add VLSHR/VSHL as well but don't currently have test coverage for them - I'll see if we can add it to AArch64SelectionDAGTest.cpp
>
> We select these nodes to the instructions with constant shifts in the range of 1-BW, so slightly outside of normal ranges but all produce valid values (no poisons). Assuming this is true should be fine, it should fail elsewhere if not.
OK - by the looks of it computeKnownBits etc. already assume its all OK, so I'll do the same.
> > I'll see if I can add test coverage for this - some of the freeze folds will strip poison flags like Exact when they push the freeze through the node - could that be whats causing the regression?
>
> The `exact` flag is used just to produce SCVTF _shift instructions as far as I understand. Am I correct that a shift with an `exact` flag will produce poison if non-zeroes are shifted out? It doesn't seem to be part of the ValueTracking canCreateUndefOrPoison or SelectionDAG::canCreateUndefOrPoison.
DAG.visitFREEZE will canCreateUndefOrPoison with ConsiderFlags=false, which means it ignores the Exact flag. If it succeeds in pushing the FREEZE through it will create a new VASHR node but without the Exact flag. Its a hack but we could always treat ConsiderFlags=true for these node and fail if they have the Exact flag.
https://github.com/llvm/llvm-project/pull/156445
More information about the llvm-commits
mailing list