summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Pop <sebpop@gmail.com>2016-09-22 17:22:58 +0000
committerSebastian Pop <sebpop@gmail.com>2016-09-22 17:22:58 +0000
commit1531f30ccc28b21915902a00be8792c39d35410a (patch)
treeeb48514af2e182d652841dd0ad6849a3904bd6d0
parentb66efb855c14a50047bea913f2beed3bd46930c7 (diff)
downloadbcm5719-llvm-1531f30ccc28b21915902a00be8792c39d35410a.tar.gz
bcm5719-llvm-1531f30ccc28b21915902a00be8792c39d35410a.zip
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
-rw-r--r--llvm/lib/Transforms/Scalar/GVNHoist.cpp3
1 files changed, 3 insertions, 0 deletions
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<MemoryUse>(&MA);
if (!MU)
OpenPOWER on IntegriCloud