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

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 18 12:56:30 PDT 2004



Changes in directory llvm/lib/Transforms/IPO:

GlobalConstifier.cpp updated: 1.3 -> 1.4

---
Log message:

Strip out and simplify some code.  This also fixes the regression last
night compiling cfrac.  It did not realize that code like this:

int G; int *H = &G;

takes the address of G.



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

Index: llvm/lib/Transforms/IPO/GlobalConstifier.cpp
diff -u llvm/lib/Transforms/IPO/GlobalConstifier.cpp:1.3 llvm/lib/Transforms/IPO/GlobalConstifier.cpp:1.4
--- llvm/lib/Transforms/IPO/GlobalConstifier.cpp:1.3	Sat Jul 17 19:25:57 2004
+++ llvm/lib/Transforms/IPO/GlobalConstifier.cpp	Sun Jul 18 14:56:20 2004
@@ -44,16 +44,9 @@
 ///
 static bool isStoredThrough(Value *V) {
   for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI)
-    if (Constant *C = dyn_cast<Constant>(*UI)) {
-      if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
-        if (isStoredThrough(CE))
-          return true;
-      } else if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) {
-        if (isStoredThrough(GV)) return true;
-      } else {
-        // Must be an element of a constant array or something.
+    if (ConstantExpr *CE = dyn_cast<ConstantExpr>(*UI)) {
+      if (isStoredThrough(CE))
         return true;
-      }
     } else if (Instruction *I = dyn_cast<Instruction>(*UI)) {
       if (I->getOpcode() == Instruction::GetElementPtr) {
         if (isStoredThrough(I)) return true;





More information about the llvm-commits mailing list