[LLVMdev] Question about nsw and nuw flags

Brian West bnwest at rice.edu
Thu Jan 13 07:51:26 PST 2011


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






More information about the llvm-dev mailing list