<div dir="ltr">Thank you for fixing this!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 22, 2016 at 7:50 AM, Geoff Berry <span dir="ltr"><<a href="mailto:gberry@codeaurora.org" target="_blank">gberry@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This revision was automatically updated to reflect the committed changes.<br>
Closed by commit rL267157: [MemorySSA] Fix bug in CachingMemorySSAWalker::invalidateInfo (authored by gberry).<br>
<br>
Changed prior to commit:<br>
  <a href="http://reviews.llvm.org/D19388?vs=54570&id=54651#toc" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19388?vs=54570&id=54651#toc</a><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D19388" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19388</a><br>
<br>
Files:<br>
  llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h<br>
  llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp<br>
<br>
Index: llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp<br>
===================================================================<br>
--- llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp<br>
+++ llvm/trunk/lib/Transforms/Utils/MemorySSA.cpp<br>
<div><div class="h5">@@ -799,19 +799,16 @@<br>
     if (!Q.IsCall)<br>
       Q.StartingLoc = MemoryLocation::get(I);<br>
     doCacheRemove(MA, Q, Q.StartingLoc);<br>
-    return;<br>
-  }<br>
-  // If it is not a use, the best we can do right now is destroy the cache.<br>
-  bool IsCall = false;<br>
-<br>
-  if (auto *MUD = dyn_cast<MemoryUseOrDef>(MA)) {<br>
-    Instruction *I = MUD->getMemoryInst();<br>
-    IsCall = bool(ImmutableCallSite(I));<br>
-  }<br>
-  if (IsCall)<br>
+  } else {<br>
+    // If it is not a use, the best we can do right now is destroy the cache.<br>
     CachedUpwardsClobberingCall.clear();<br>
-  else<br>
     CachedUpwardsClobberingAccess.clear();<br>
+  }<br>
+<br>
+#ifdef XDEBUG<br>
+  // Run this only when expensive checks are enabled.<br>
+  verifyRemoved(MA);<br>
+#endif<br>
 }<br>
<br>
 void CachingMemorySSAWalker::doCacheRemove(const MemoryAccess *M,<br>
@@ -1081,6 +1078,18 @@<br>
   return Result;<br>
 }<br>
<br>
</div></div><span class="">+// Verify that MA doesn't exist in any of the caches.<br>
+void CachingMemorySSAWalker::verifyRemoved(MemoryAccess *MA) {<br>
</span>+#ifndef NDEBUG<br>
<span class="">+  for (auto &P : CachedUpwardsClobberingAccess)<br>
+    assert(P.first.first != MA && P.second != MA &&<br>
+           "Found removed MemoryAccess in cache.");<br>
+  for (auto &P : CachedUpwardsClobberingCall)<br>
+    assert(P.first != MA && P.second != MA &&<br>
+           "Found removed MemoryAccess in cache.");<br>
</span>+#endif // !NDEBUG<br>
+}<br>
<span class="">+<br>
 MemoryAccess *<br>
 DoNothingMemorySSAWalker::getClobberingMemoryAccess(const Instruction *I) {<br>
   MemoryAccess *MA = MSSA->getMemoryAccess(I);<br>
</span>Index: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h<br>
===================================================================<br>
--- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h<br>
+++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h<br>
@@ -756,6 +756,7 @@<br>
<span class="">   MemoryAccess *getClobberingMemoryAccess(MemoryAccess *, UpwardsMemoryQuery &);<br>
   bool instructionClobbersQuery(const MemoryDef *, UpwardsMemoryQuery &,<br>
                                 const MemoryLocation &Loc) const;<br>
</span>+  void verifyRemoved(MemoryAccess *);<br>
<div class="HOEnZb"><div class="h5">   SmallDenseMap<ConstMemoryAccessPair, MemoryAccess *><br>
       CachedUpwardsClobberingAccess;<br>
   DenseMap<const MemoryAccess *, MemoryAccess *> CachedUpwardsClobberingCall;<br>
<br>
<br>
</div></div></blockquote></div><br></div>