[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

John Criswell criswell at choi.cs.uiuc.edu
Mon Jul 21 14:44:02 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.95 -> 1.96

---
Log message:

Added code that checks to see if a global variable is external before replacing
a load of the global variable with the variable's constant value.


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.95 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.96
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.95	Thu Jul 17 14:06:55 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Jul 21 14:42:57 2003
@@ -1294,7 +1294,7 @@
 
   // Instcombine load (constant global) into the value loaded...
   if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op))
-    if (GV->isConstant())
+    if ((GV->isConstant()) && (!(GV->isExternal())))
       return ReplaceInstUsesWith(LI, GV->getInitializer());
 
   // Instcombine load (constantexpr_GEP global, 0, ...) into the value loaded...





More information about the llvm-commits mailing list