Assert in MemorySSA::renamePass on LLVM 12


I encountered an assert in MemorySSA.cpp. The assert happens in the following line:

void MemorySSA::renamePass(DomTreeNode *Root, MemoryAccess *IncomingVal,
SmallPtrSetImpl<BasicBlock *> &Visited,
bool SkipVisited, bool RenameAllUses) {
assert(Root && “Trying to rename accesses in an unreachable block”);

SmallVector<RenamePassData, 32> WorkStack;

I have a bitcode file that I pass to wasm-ld e.g. wasm-ld foo.bc -o ~/foo.wasm --no-entry. I would really appreciate any help or hints to start understanding this problem and debug it. Thanks!