summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-07-17 19:06:55 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-07-17 19:06:55 +0000
commit0643ceafcf43c0a41099b75c0050eef29632e7c6 (patch)
treec3664274b97a18cb2577e8cea79817f431fb31ae /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parent110f07b5fe3a5d9720454bdd989714161e07c66a (diff)
downloadbcm5719-llvm-0643ceafcf43c0a41099b75c0050eef29632e7c6.tar.gz
bcm5719-llvm-0643ceafcf43c0a41099b75c0050eef29632e7c6.zip
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. llvm-svn: 7193
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 5d04d7737ff..bb8f97be3b9 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -1302,7 +1302,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
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;
OpenPOWER on IntegriCloud