[llvm-commits] [llvm] r140875 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Jim Grosbach grosbach at apple.com
Fri Sep 30 12:58:47 PDT 2011


Author: grosbach
Date: Fri Sep 30 14:58:46 2011
New Revision: 140875

URL: http://llvm.org/viewvc/llvm-project?rev=140875&view=rev
Log:
Don't modify constant in-place.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=140875&r1=140874&r2=140875&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Fri Sep 30 14:58:46 2011
@@ -2839,10 +2839,11 @@
 
         // Avoid lossy conversions and denormals. Zero is a special case
         // that's OK to convert.
-        F.clearSign();
+        APFloat Fabs = F;
+        Fabs.clearSign();
         if (!Lossy &&
-            ((F.compare(APFloat::getSmallestNormalized(*Sem)) !=
-                 APFloat::cmpLessThan) || F.isZero()))
+            ((Fabs.compare(APFloat::getSmallestNormalized(*Sem)) !=
+                 APFloat::cmpLessThan) || Fabs.isZero()))
 
           return new FCmpInst(I.getPredicate(), LHSExt->getOperand(0),
                               ConstantFP::get(RHSC->getContext(), F));





More information about the llvm-commits mailing list