[PATCH] D130164: [LV] Support predicated div/rem operations via safe-divisor select idiom

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 11:07:34 PDT 2022


efriedma added a comment.

On targets with a vector "div" instruction, the instruction never actually traps or otherwise misbehaves; the only reason we have an issue here is that the IR "sdiv" is defined to be instant UB.  Maybe we could consider introducing a new IR operation to model this?  Maybe it doesn't really matter, though; division is expensive enough that the cost of an extra "select" is probably insignificant.

> Not thinking about it real hard, int_max/uint_max might be reasonable.

That doesn't work for srem; the absolute value of int_min is larger than int_max.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130164/new/

https://reviews.llvm.org/D130164



More information about the llvm-commits mailing list