[llvm-dev] Planned change to IR semantics: constant expressions never have undefined behavior

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 14 15:58:53 PDT 2019

> On Jun 14, 2019, at 3:24 PM, Eli Friedman via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> See https://reviews.llvm.org/D63036 <https://reviews.llvm.org/D63036> for the full patch and description. Essentially, the Constant::canTrap API is going away.  To make this work, the semantics of division and remainder constant expressions are changing slightly, so division by zero produces poison, not undefined behavior.  (The corresponding instructions still have undefined behavior.)  This change should make writing and understanding IR optimizations easier.

Is anyone interested and willing to make a more profound change to llvm’s constants?  We should really remove all the trapping operators.  The only reason they exist in the first place is to allow use of Constant::get() as a high level constant folding API.  We could replace that, eliminate the trapping operators, and thus eliminate a ton of complexity and bugs…


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190614/1d9f3a18/attachment-0001.html>

More information about the llvm-dev mailing list