[llvm-commits] [dragonegg] r92713 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Tue Jan 5 00:11:59 PST 2010


Author: baldrick
Date: Tue Jan  5 02:11:58 2010
New Revision: 92713

URL: http://llvm.org/viewvc/llvm-project?rev=92713&view=rev
Log:
Port commit 91663 (djg) from llvm-gcc:
Add the NSW bit to integer negation operators.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=92713&r1=92712&r2=92713&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Jan  5 02:11:58 2010
@@ -3137,7 +3137,8 @@
   if (TREE_CODE(TREE_TYPE(op)) != COMPLEX_TYPE) {
     if (V->getType()->isFPOrFPVector())
       return Builder.CreateFNeg(V);
-    return Builder.CreateNeg(V);
+    bool HasNSW = !TYPE_UNSIGNED(TREE_TYPE(op)) && !flag_wrapv;
+    return HasNSW ? Builder.CreateNSWNeg(V) : Builder.CreateNeg(V);
   }
 
   // -(a+ib) = -a + i*-b





More information about the llvm-commits mailing list