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 | 067947380c5d7b1bc867f71bab6f672a1b109405 (patch) | |
tree | 00bd0d4a454fff18d4544573a5fef34416ce81c5 /lib | |
parent | cf2a7385ddc65313b9a5b7c5786ae609e4881bc4 (diff) | |
download | llvm-067947380c5d7b1bc867f71bab6f672a1b109405.tar.gz llvm-067947380c5d7b1bc867f71bab6f672a1b109405.tar.bz2 llvm-067947380c5d7b1bc867f71bab6f672a1b109405.tar.xz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index bb8f97be3b..b066decee0 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<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... |