[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 Dec 20 12:01:36 PST 2018
asbirlea created this revision.
asbirlea added a reviewer: george.burgess.iv.
Herald added subscribers: Prazek, jlebar, sanjoy.
The option enables loop transformations to hoist accesses that do not
have clobbers in the loop. If the clobber queries skips the starting
access, the result may be outside the loop instead of the header Phi.
Adding the walker that uses this option in a separate patch.
Repository:
rL LLVM
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;
@@ -619,9 +620,19 @@
if (!VisitedPhis.insert({Node.Last, Node.Loc}).second)
continue;
- UpwardsWalkResult Res = walkToPhiOrClobber(Node, /*StopAt=*/StopWhere);
+ const MemoryAccess *RealStopWhere = StopWhere;
+ bool ReplacedStopWhere = false;
+ if (Query->SkipSelfAccess && Query->OriginalAccess &&
+ Node.Loc == Query->StartingLoc &&
+ Node.Last->getBlock() == Query->OriginalAccess->getBlock()) {
+ assert(isa<MemoryDef>(Query->OriginalAccess));
+ RealStopWhere = Query->OriginalAccess;
+ ReplacedStopWhere = true;
+ }
+
+ UpwardsWalkResult Res = walkToPhiOrClobber(Node, /*StopAt=*/RealStopWhere);
if (Res.IsKnownClobber) {
- assert(Res.Result != StopWhere);
+ assert(Res.Result != RealStopWhere);
// If this wasn't a cache hit, we hit a clobber when walking. That's a
// failure.
TerminatedPath Term{Res.Result, PathIndex};
@@ -633,10 +644,11 @@
continue;
}
- if (Res.Result == StopWhere) {
+ if (Res.Result == RealStopWhere) {
// We've hit our target. Save this path off for if we want to continue
// walking.
- NewPaused.push_back(PathIndex);
+ if (!ReplacedStopWhere)
+ NewPaused.push_back(PathIndex);
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55944.179116.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181220/db8f3a21/attachment.bin>
More information about the llvm-commits
mailing list