diff --git a/lib/Analysis/MemorySSA.cpp b/lib/Analysis/MemorySSA.cpp index 6fc827ae2b1..f54f04460a4 100644 --- a/lib/Analysis/MemorySSA.cpp +++ b/lib/Analysis/MemorySSA.cpp @@ -1726,8 +1726,11 @@ MemoryUseOrDef *MemorySSA::createDefinedAccess(Instruction *I, if (CreationMustSucceed) assert(NewAccess != nullptr && "Tried to create a memory access for a " "non-memory touching instruction"); - if (NewAccess) + if (NewAccess) { + assert((!Definition || !isa(Definition)) && + "A use cannot be a defining access"); NewAccess->setDefiningAccess(Definition); + } return NewAccess; }