diff options
author | John Criswell <criswell@uiuc.edu> | 2003-07-21 19:42:57 +0000 |
---|---|---|
committer | John Criswell <criswell@uiuc.edu> | 2003-07-21 19:42:57 +0000 |
commit | d6dcbc6ce83f597c69a0a95355c36fa456cd6abd (patch) | |
tree | 23045f17e1a8254d9d68f8bf1e7ed5f3c32da613 | |
parent | 57886cb4da32fc0f9f95eeb0d59e4d7e29145f76 (diff) | |
download | bcm5719-llvm-d6dcbc6ce83f597c69a0a95355c36fa456cd6abd.tar.gz bcm5719-llvm-d6dcbc6ce83f597c69a0a95355c36fa456cd6abd.zip |
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
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index bb8f97be3b9..b066decee0b 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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<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... |