diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -2551,6 +2551,11 @@ }; Ptr = Ptr->stripPointerCasts(); + if (auto *I = dyn_cast(Ptr)) { + if (I->getParent() == &I->getFunction()->getEntryBlock()) { + return true; + } + } if (auto *GEP = dyn_cast(Ptr)) { return IsGuaranteedLoopInvariantBase(GEP->getPointerOperand()) && GEP->hasAllConstantIndices();