[llvm] r282175 - GVN-hoist: do not dereference null pointers
Sebastian Pop via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 10:22:58 PDT 2016
Author: spop
Date: Thu Sep 22 12:22:58 2016
New Revision: 282175
URL: http://llvm.org/viewvc/llvm-project?rev=282175&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp?rev=282175&r1=282174&r2=282175&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp Thu Sep 22 12:22:58 2016
@@ -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)
More information about the llvm-commits
mailing list