[PATCH] D19388: [MemorySSA] Fix bug in CachingMemorySSAWalker::invalidateInfo
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 08:06:08 PDT 2016
Thank you for fixing this!
On Fri, Apr 22, 2016 at 7:50 AM, Geoff Berry <gberry at codeaurora.org> wrote:
> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL267157: [MemorySSA] Fix bug in
> CachingMemorySSAWalker::invalidateInfo (authored by gberry).
>
> Changed prior to commit:
> http://reviews.llvm.org/D19388?vs=54570&id=54651#toc
>
> Repository:
> rL LLVM
>
> http://reviews.llvm.org/D19388
>
> Files:
> llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
> llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
>
> Index: llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
> ===================================================================
> --- llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
> +++ llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp
> @@ -799,19 +799,16 @@
> if (!Q.IsCall)
> Q.StartingLoc = MemoryLocation::get(I);
> doCacheRemove(MA, Q, Q.StartingLoc);
> - return;
> - }
> - // If it is not a use, the best we can do right now is destroy the
> cache.
> - bool IsCall = false;
> -
> - if (auto *MUD = dyn_cast<MemoryUseOrDef>(MA)) {
> - Instruction *I = MUD->getMemoryInst();
> - IsCall = bool(ImmutableCallSite(I));
> - }
> - if (IsCall)
> + } else {
> + // If it is not a use, the best we can do right now is destroy the
> cache.
> CachedUpwardsClobberingCall.clear();
> - else
> CachedUpwardsClobberingAccess.clear();
> + }
> +
> +#ifdef XDEBUG
> + // Run this only when expensive checks are enabled.
> + verifyRemoved(MA);
> +#endif
> }
>
> void CachingMemorySSAWalker::doCacheRemove(const MemoryAccess *M,
> @@ -1081,6 +1078,18 @@
> return Result;
> }
>
> +// Verify that MA doesn't exist in any of the caches.
> +void CachingMemorySSAWalker::verifyRemoved(MemoryAccess *MA) {
> +#ifndef NDEBUG
> + for (auto &P : CachedUpwardsClobberingAccess)
> + assert(P.first.first != MA && P.second != MA &&
> + "Found removed MemoryAccess in cache.");
> + for (auto &P : CachedUpwardsClobberingCall)
> + assert(P.first != MA && P.second != MA &&
> + "Found removed MemoryAccess in cache.");
> +#endif // !NDEBUG
> +}
> +
> MemoryAccess *
> DoNothingMemorySSAWalker::getClobberingMemoryAccess(const Instruction *I)
> {
> MemoryAccess *MA = MSSA->getMemoryAccess(I);
> Index: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
> ===================================================================
> --- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
> +++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
> @@ -756,6 +756,7 @@
> MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
> UpwardsMemoryQuery &);
> bool instructionClobbersQuery(const MemoryDef *, UpwardsMemoryQuery &,
> const MemoryLocation &Loc) const;
> + void verifyRemoved(MemoryAccess *);
> SmallDenseMap<ConstMemoryAccessPair, MemoryAccess *>
> CachedUpwardsClobberingAccess;
> DenseMap<const MemoryAccess *, MemoryAccess *>
> CachedUpwardsClobberingCall;
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160422/8df2b648/attachment.html>
More information about the llvm-commits
mailing list