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.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Thanks for the patch!
lib/Analysis/MemorySSAUpdater.cpp | ||
---|---|---|
126 ↗ | (On Diff #101598) | If we instead refactor this else block to look something like: auto End = getWritableBlockAccesses()->rend(); for (auto &U : make_range(++MA->getReverseIterator(), End)) if (!isa<MemoryUse>(U)) return cast<MemoryAccess>(&U); // Note that if MA comes before Defs->begin(), we won't hit a def. return nullptr; does that still fix the problem? Personally, I feel like that's clearer about the intent, and is probably less prone to edge-cases. |
126 ↗ | (On Diff #101598) | Oops; I meant: auto End = getWritableBlockAccesses(MA->getBlock())->rend(); |
lib/Analysis/MemorySSAUpdater.cpp | ||
---|---|---|
126 ↗ | (On Diff #101598) | I was going to suggest the same thing george did :) |