[PATCH] D117210: [CodeGen] Support folds of not(cmp(cc, ...)) -> cmp(!cc, ...) for scalable vectors
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 21 01:42:49 PST 2022
david-arm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3160
APInt CVal;
if (auto *CN = dyn_cast<ConstantSDNode>(N)) {
CVal = CN->getAPIntValue();
----------------
sdesmalen wrote:
> Instead of checking for SPLAT_VECTOR explicitly, how about:
>
> if (auto *CN = dyn_cast<ConstantSDNode>(N)) {
> CVal = CN->getAPIntValue();
> } else if (isConstantSplatVector(N, CVal)) {
> unsigned EltWidth = N->getValueType(0).getScalarSizeInBits();
> if (EltWidth < CVal.getBitwidth())
> CVal = CVal.trunc(EltWidth);
> } else
> return false;
>
Sadly this doesn't work because `isConstantSplatVector` demands the element width of the result be the same as the element width in the BuildVectorSDNode, which means we end up with lots of failing tests. It's just a minor point, but `isConstantSplatVector` also permits FP splats, so we'd have to restrict it to integer too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117210/new/
https://reviews.llvm.org/D117210
More information about the llvm-commits
mailing list