[llvm] [InstCombine] Split div/rem by a select of constants with a variable dividend (PR #216908)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 23:59:15 PDT 2026
Andarwinux wrote:
> Yes, we need that for the non pow2 cases. We get lucky on near pow2 because InstCombine rewrites the pow2 arm to lshr first, so the arms no longer share an opcode and foldSelectOpOp cannot match them. The InstCombine and DAG guards will be needed for those.
If InstCombine needs to be changed anyway, I think InstCombine+DAG is better than InstCombine+VectorCombine+DAG.
Overall, I think this transformation itself doesn't really need to be cost-driven. Its purpose is to expose the real cost of division by constant for later middle transformations, so there's no need to place it in VectorCombine.
https://github.com/llvm/llvm-project/pull/216908
More information about the llvm-commits
mailing list