From: John Criswell Date: Mon, 21 Jul 2003 19:42:57 +0000 (+0000) Subject: Added code that checks to see if a global variable is external before replacing X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=067947380c5d7b1bc867f71bab6f672a1b109405;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7216 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index bb8f97be3b9..b066decee0b 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1294,7 +1294,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { // Instcombine load (constant global) into the value loaded... if (GlobalVariable *GV = dyn_cast(Op)) - if (GV->isConstant()) + if ((GV->isConstant()) && (!(GV->isExternal()))) return ReplaceInstUsesWith(LI, GV->getInitializer()); // Instcombine load (constantexpr_GEP global, 0, ...) into the value loaded...