[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Dec 11 22:03:20 PST 2004



Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.30 -> 1.31
---
Log message:

Though the previous xform applies to literally dozens (hundreds?) of variables
in SPEC, the subsequent optimziations that we are after don't play with
with FP values, so disable this xform for them.  Really we just don't want
stuff like:

double G;   (always 0 or 412312.312)
  = G;

turning into:

bool G_b;
  = G_b ? 412312.312 : 0;

We'd rather just do the load.

-Chris



---
Diffs of the changes:  (+2 -1)

Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.30 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.31
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.30	Sat Dec 11 23:53:50 2004
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp	Sun Dec 12 00:03:06 2004
@@ -954,7 +954,8 @@
       // Otherwise, if the global was not a boolean, we can shrink it to be a
       // boolean.
       if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue))
-        if (GV->getType()->getElementType() != Type::BoolTy) {
+        if (GV->getType()->getElementType() != Type::BoolTy &&
+            !GV->getType()->getElementType()->isFloatingPoint()) {
           DEBUG(std::cerr << "   *** SHRINKING TO BOOL: " << *GV);
           ShrinkGlobalToBoolean(GV, SOVConstant);
           ++NumShrunkToBool;






More information about the llvm-commits mailing list