[llvm] [LV]Partial replace the mask for div/rem safe-divisor select (PR #165530)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 6 01:13:49 PST 2025


https://github.com/lukel97 commented:

I guess this is an interesting way of dealing with divs/rems. This transform will mean that if the original loop had a divide by zero we will now always mask it, which I guess is correct because it's UB?

It's probably worthwhile mentioning that https://github.com/llvm/llvm-project/pull/154076 also aims to remove the safe-divisor-select but by using predicated intrinsics on RISC-V. I think long term we will want to use VP intrinsics for the div/rems as it will allow some microarchitectures to use VL to avoid executing on the tail lanes.

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


More information about the llvm-commits mailing list