[llvm-dev] Is trapping allowed when an add with nsw flag overflows?
Manuel Jacob via llvm-dev
llvm-dev at lists.llvm.org
Fri Apr 15 10:28:00 PDT 2016
Hi,
In our backend, we currently emit add operations that trap on overflow
if the IR operation has the nsw flag set. Is this allowed?
According to the documentation about poison values, overflowing a nsw
add is undefined behavior. However I didn't find a formal definition of
undefined behavior in LLVM. Judging from previous discussions on the
mailing list, there seems to be a vague line of what LLVM is allowed to
do in case of undefined behavior. Is trapping allowed?
-Manuel
More information about the llvm-dev
mailing list