[llvm] [VPlan] Use llvm.masked.{u, s}{div, rem} for predicated division (PR #191377)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 01:24:37 PDT 2026


https://github.com/Mel-Chen commented:

Overall, this looks like a move in good direction to me, though there are still some details to be ironed out. In addition to the issues raised by @eas, I noticed the following logic in simplifyRecipe:
```
if (CanCreateNewRecipe && match(Def, m_UDiv(m_VPValue(A), m_APInt(APC))) &&
    APC->isPowerOf2())
  return Def->replaceAllUsesWith(Builder.createNaryOp(
      Instruction::LShr,
      {A, Plan->getConstantInt(APC->getBitWidth(), APC->exactLogBase2())},
      *cast<VPRecipeWithIRFlags>(Def), Def->getDebugLoc()));
```
Will this optimization be invalidated (or stop being triggered) after this patch?

https://github.com/llvm/llvm-project/pull/191377


More information about the llvm-commits mailing list