[PATCH] D55944: [MemorySSA] Extend the clobber walker with the option to skip the starting access.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 3 15:45:40 PST 2019
asbirlea updated this revision to Diff 180169.
asbirlea added a comment.
Update setting of where to stop in getBlockingAccess:
- dropping the check for block since we may no longer be in the starting block after adding a paused path.
- adding a second StopAt access in walkToPhiOrClobber, only set when skipping self and for the same location.
- keeping paused path when the original StopAt is found.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55944/new/
https://reviews.llvm.org/D55944
Files:
lib/Analysis/MemorySSA.cpp
Index: lib/Analysis/MemorySSA.cpp
===================================================================
--- lib/Analysis/MemorySSA.cpp
+++ lib/Analysis/MemorySSA.cpp
@@ -332,6 +332,7 @@
// The MemoryAccess we actually got called with, used to test local domination
const MemoryAccess *OriginalAccess = nullptr;
Optional<AliasResult> AR = MayAlias;
+ bool SkipSelfAccess = false;
UpwardsMemoryQuery() = default;
@@ -535,13 +536,13 @@
///
/// This does not test for whether StopAt is a clobber
UpwardsWalkResult
- walkToPhiOrClobber(DefPath &Desc,
- const MemoryAccess *StopAt = nullptr) const {
+ walkToPhiOrClobber(DefPath &Desc, const MemoryAccess *StopAt = nullptr,
+ const MemoryAccess *SkipStopAt = nullptr) const {
assert(!isa<MemoryUse>(Desc.Last) && "Uses don't exist in my world");
for (MemoryAccess *Current : def_chain(Desc.Last)) {
Desc.Last = Current;
- if (Current == StopAt)
+ if (Current == StopAt || Current == SkipStopAt)
return {Current, false, MayAlias};
if (auto *MD = dyn_cast<MemoryDef>(Current)) {
@@ -619,9 +620,16 @@
if (!VisitedPhis.insert({Node.Last, Node.Loc}).second)
continue;
- UpwardsWalkResult Res = walkToPhiOrClobber(Node, /*StopAt=*/StopWhere);
+ const MemoryAccess *SkipStopWhere = nullptr;
+ if (Query->SkipSelfAccess && Node.Loc == Query->StartingLoc) {
+ assert(isa<MemoryDef>(Query->OriginalAccess));
+ SkipStopWhere = Query->OriginalAccess;
+ }
+
+ UpwardsWalkResult Res = walkToPhiOrClobber(Node, /*StopAt=*/StopWhere,
+ /*SkipStopAt=*/SkipStopWhere);
if (Res.IsKnownClobber) {
- assert(Res.Result != StopWhere);
+ assert(Res.Result != StopWhere && Res.Result != SkipStopWhere);
// If this wasn't a cache hit, we hit a clobber when walking. That's a
// failure.
TerminatedPath Term{Res.Result, PathIndex};
@@ -633,10 +641,13 @@
continue;
}
- if (Res.Result == StopWhere) {
+ if (Res.Result == StopWhere || Res.Result == SkipStopWhere) {
// We've hit our target. Save this path off for if we want to continue
- // walking.
- NewPaused.push_back(PathIndex);
+ // walking. If we are in the mode of skipping the OriginalAccess, and
+ // we've reached back to the OriginalAccess, do not save path, we've
+ // just looped back to self.
+ if (Res.Result == StopWhere)
+ NewPaused.push_back(PathIndex);
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55944.180169.patch
Type: text/x-patch
Size: 2622 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/41af015d/attachment.bin>
More information about the llvm-commits
mailing list