diff --git a/llvm/lib/Analysis/MemorySSA.cpp b/llvm/lib/Analysis/MemorySSA.cpp index 1c5858abf8ce..ee702fd3c5d6 100644 --- a/llvm/lib/Analysis/MemorySSA.cpp +++ b/llvm/lib/Analysis/MemorySSA.cpp @@ -429,18 +429,23 @@ checkClobberSanity(const MemoryAccess *Start, MemoryAccess *ClobberAt, // 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(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(MA)) { + assert (MU == Start && + "Can only find use in def chain if Start is a use"); + continue; + } + assert(isa(MA)); Worklist.append( upward_defs_begin({const_cast(MA), MAP.second}),