From 7924acd64f3ff5099ddbfe3f5964a919c22b639e Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 22 Sep 2016 17:22:58 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282175 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/GVNHoist.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Transforms/Scalar/GVNHoist.cpp b/lib/Transforms/Scalar/GVNHoist.cpp index 3c2ac6fcd5f..03fd4872a0a 100644 --- a/lib/Transforms/Scalar/GVNHoist.cpp +++ b/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) -- 2.50.1