Question about nsw and nuw flags

Hi everybody,

I saw that there are some instructions in the programs in which the flag nsw or nuw is placed. I wonder what rules does LLVM follows to put these flags in some instructions.

Best,

Douglas

Hi Douglas,

The canonical reference for these types of questions is the IR description, here: http://llvm.org/docs/LangRef.html

-Chris

Douglas do Couto Teixeira <douglasdocouto <at> gmail.com> writes:

Hi everybody,I saw that there are some instructions in the programs in which

the flag nsw or nuw is placed. I wonder what rules does LLVM follows to put
these flags in some instructions.Best,Douglas

Language requirements appears to drive their placement. In C, "signed int"
overflow produces a trap value and undefined behavior. Thus, C "signed int"
operations do not wrap on overflow and get tagged with "nsw" in the LLVM IR.

Brian West