From a676b787917559c246298ec789ce0ea290f95a70 Mon Sep 17 00:00:00 2001 From: John Criswell Date: Thu, 17 Jul 2003 19:06:55 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7193 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/InstructionCombining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5d04d7737ff..bb8f97be3b9 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1302,7 +1302,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { if (CE->getOpcode() == Instruction::GetElementPtr) if (ConstantPointerRef *G=dyn_cast(CE->getOperand(0))) if (GlobalVariable *GV = dyn_cast(G->getValue())) - if (GV->isConstant()) + if ((GV->isConstant()) && (!(GV->isExternal()))) if (Constant *V = GetGEPGlobalInitializer(GV->getInitializer(), CE)) return ReplaceInstUsesWith(LI, V); return 0; -- 2.34.1