[PATCH] D33950: [mssa] If there is no definition in a block prior to an inserted use, return nullptr.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 12:01:26 PDT 2017
asbirlea created this revision.
Herald added subscribers: Prazek, sanjoy.
Check that the first access before one being tested is valid.
Before this patch, if there was no definition prior to the Use being tested,
the first time Iter was deferenced, it hit the sentinel.
Patch updates the check and return nullptr.
https://reviews.llvm.org/D33950
Files:
lib/Analysis/MemorySSAUpdater.cpp
Index: lib/Analysis/MemorySSAUpdater.cpp
===================================================================
--- lib/Analysis/MemorySSAUpdater.cpp
+++ lib/Analysis/MemorySSAUpdater.cpp
@@ -125,11 +125,10 @@
} else {
// Otherwise, have to walk the all access iterator.
auto Iter = MA->getReverseIterator();
- ++Iter;
while (&*Iter != &*Defs->begin()) {
- if (!isa<MemoryUse>(*Iter))
- return &*Iter;
--Iter;
+ if (!isa<MemoryUse>(*Iter))
+ return nullptr;
}
// At this point it must be pointing at firstdef
assert(&*Iter == &*Defs->begin() &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33950.101598.patch
Type: text/x-patch
Size: 635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170606/db8d3112/attachment.bin>
More information about the llvm-commits
mailing list