[llvm] [LV][EVL] Replace VPInstruction::Select with vp.merge for predicated div/rem (PR #154072)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 02:39:36 PDT 2025
Mel-Chen wrote:
> I'm not sure if this is the right approach, since it still leaves around a vmv.v.i to mask the divisor. What I originally tried in #148828 was to fold the div/rem into a VP div/rem, but in that PR it was relying on nothing in the VPlan ever reading past EVL lanes.
>
> What I think is safer is to emit the VP intrinsic when the recipe is initially being widened using a mask, that way we know the lanes are defined as poison, and then optimising the mask to EVL in`optimizeMaskToEVL`. I've opened up #154076 for this, what do you think?
This patch wasn’t intended to address the vp.div issue, actually. :D
I just notice that we never performed this transformation, and in fact it should affect correctness before we replace the header mask with the EVL mask. It just hadn’t been caught until now.
https://github.com/llvm/llvm-project/pull/154072
More information about the llvm-commits
mailing list