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.

llvm-svn: 7216
This commit is contained in:
John Criswell 2003-07-21 19:42:57 +00:00
parent 57886cb4da
commit d6dcbc6ce8
1 changed files with 1 additions and 1 deletions

View File

@ -1294,7 +1294,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
// 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...