From 1531f30ccc28b21915902a00be8792c39d35410a Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 22 Sep 2016 17:22:58 +0000 Subject: GVN-hoist: do not dereference null pointers there may be basic blocks without memory accesses, in which case the list of accesses is a null pointer. llvm-svn: 282175 --- llvm/lib/Transforms/Scalar/GVNHoist.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp index 3c2ac6fcd5f..03fd4872a0a 100644 --- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp +++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp @@ -338,6 +338,9 @@ private: bool ReachedNewPt = false; MemoryLocation DefLoc = MemoryLocation::get(OldPt); const MemorySSA::AccessList *Acc = MSSA->getBlockAccesses(BB); + if (!Acc) + return false; + for (const MemoryAccess &MA : *Acc) { auto *MU = dyn_cast(&MA); if (!MU) -- cgit v1.2.3