From 890090f7f58e780f1b81f553cc933f3f4e36013a Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Tue, 1 Oct 2019 19:09:50 +0000 Subject: [MemorySSA] Check for unreachable blocks when getting last definition. If a single predecessor is found, still check if the block is unreachable. The test that found this had a self loop unreachable block. Resolves PR43493. llvm-svn: 373383 --- llvm/lib/Analysis/MemorySSAUpdater.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Analysis') diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index 315037bcc04..e0b27f1d501 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -839,6 +839,9 @@ void MemorySSAUpdater::applyInsertUpdates(ArrayRef Updates, } else { // Single predecessor, BB cannot be dead. GetLastDef of Pred. assert(Count == 1 && Pred && "Single predecessor expected."); + // BB can be unreachable though, return LoE if that is the case. + if (!DT.getNode(BB)) + return MSSA->getLiveOnEntryDef(); BB = Pred; } }; -- cgit v1.2.3