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

John Criswell criswell at choi.cs.uiuc.edu
Thu Jul 17 14:08:19 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.94 -> 1.95

---
Log message:

Dinakar and I fixed a bug where we were trying to get the initializer of
an external constant.  Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.94 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.95
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.94	Thu Jun 26 00:06:25 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Thu Jul 17 14:06:55 2003
@@ -1302,7 +1302,7 @@
     if (CE->getOpcode() == Instruction::GetElementPtr)
       if (ConstantPointerRef *G=dyn_cast<ConstantPointerRef>(CE->getOperand(0)))
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(G->getValue()))
-          if (GV->isConstant())
+          if ((GV->isConstant()) && (!(GV->isExternal())))
             if (Constant *V = GetGEPGlobalInitializer(GV->getInitializer(), CE))
               return ReplaceInstUsesWith(LI, V);
   return 0;





More information about the llvm-commits mailing list