[llvm] r340981 - [MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 15:38:51 PDT 2018


Author: asbirlea
Date: Wed Aug 29 15:38:51 2018
New Revision: 340981

URL: http://llvm.org/viewvc/llvm-project?rev=340981&view=rev
Log:
[MemorySSA] Fix checkClobberSanity to skip Start only for Defs and Uses.

Modified:
    llvm/trunk/lib/Analysis/MemorySSA.cpp

Modified: llvm/trunk/lib/Analysis/MemorySSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemorySSA.cpp?rev=340981&r1=340980&r2=340981&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemorySSA.cpp (original)
+++ llvm/trunk/lib/Analysis/MemorySSA.cpp Wed Aug 29 15:38:51 2018
@@ -429,18 +429,23 @@ checkClobberSanity(const MemoryAccess *S
       // We should never hit liveOnEntry, unless it's the clobber.
       assert(!MSSA.isLiveOnEntryDef(MA) && "Hit liveOnEntry before clobber?");
 
-      // If Start is a Def, skip self.
-      if (MA == Start)
-        continue;
-
       if (const auto *MD = dyn_cast<MemoryDef>(MA)) {
-        (void)MD;
+        // If Start is a Def, skip self.
+        if (MD == Start)
+          continue;
+
         assert(!instructionClobbersQuery(MD, MAP.second, Query.Inst, AA)
                     .IsClobber &&
                "Found clobber before reaching ClobberAt!");
         continue;
       }
 
+      if (const auto *MU = dyn_cast<MemoryUse>(MA)) {
+        assert (MU == Start &&
+                "Can only find use in def chain if Start is a use");
+        continue;
+      }
+
       assert(isa<MemoryPhi>(MA));
       Worklist.append(
           upward_defs_begin({const_cast<MemoryAccess *>(MA), MAP.second}),




More information about the llvm-commits mailing list