[PATCH] D141022: [SelectionDAG] Improve codegen for udiv by constant if any divisors are 1.
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 5 06:32:17 PST 2023
lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.
LG, thanks.
There may be similar opportunity at least in the `urem==C` expansion.
> DAGCombiner is unable to fold srl X, <0, undef> to X
This seems like a somewhat straight-forward missing optimization?
Although, then the second element becomes non-poison in the result.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:6067
+ PostShift = DAG.getConstant(magics.PostShift, dl, ShSVT);
+ NPQFactor = DAG.getConstant(magics.IsAdd ? APInt::getOneBitSet(EltBits, EltBits - 1) : APInt::getZero(EltBits), dl, SVT);
+ UseNPQ |= magics.IsAdd;
----------------
Not clang-formatted
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141022/new/
https://reviews.llvm.org/D141022
More information about the llvm-commits
mailing list