[llvm] [InstSimplify][InstCombine][ConstantFold] Move vector div/rem by zero fold to InstCombine (PR #114280)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 06:35:35 PDT 2024


https://github.com/nikic approved this pull request.

LGTM

After some consideration, while it is technically the threadBinOpOverSelect fold that is incorrect here, being able to treat div/rem as lane-wise operations for simplification purposes does seem like a valuable property to have.

I'd note that in InstCombine, instead of generating a poison return, we could produce a non-terminator unreachable instead. Though it's kind of weird to do that only for the vector case. It might make sense to move all the division by zero folding to InstCombine... I could see this going either way in terms of overall simplification power.

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


More information about the llvm-commits mailing list