Douglas do Couto Teixeira
2011-Jan-12 19:31 UTC
[LLVMdev] 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110112/e696af22/attachment.html>
On Jan 12, 2011, at 11:31 AM, Douglas do Couto Teixeira wrote:> 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.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 whichthe 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