diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueLatticeUtils.cpp')
| -rw-r--r-- | llvm/lib/Analysis/ValueLatticeUtils.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueLatticeUtils.cpp b/llvm/lib/Analysis/ValueLatticeUtils.cpp index 53638c351f72..2bcb4d5b0e6b 100644 --- a/llvm/lib/Analysis/ValueLatticeUtils.cpp +++ b/llvm/lib/Analysis/ValueLatticeUtils.cpp @@ -29,12 +29,13 @@ bool llvm::canTrackGlobalVariableInterprocedurally(GlobalVariable *GV) { !GV->hasDefinitiveInitializer()) return false; return all_of(GV->users(), [&](User *U) { - // Currently all users of a global variable have to be none-volatile loads - // or stores and the global cannot be stored itself. + // Currently all users of a global variable have to be non-volatile loads + // or stores of the global type, and the global cannot be stored itself. if (auto *Store = dyn_cast<StoreInst>(U)) - return Store->getValueOperand() != GV && !Store->isVolatile(); + return Store->getValueOperand() != GV && !Store->isVolatile() && + Store->getValueOperand()->getType() == GV->getValueType(); if (auto *Load = dyn_cast<LoadInst>(U)) - return !Load->isVolatile(); + return !Load->isVolatile() && Load->getType() == GV->getValueType(); return false; }); |
