This patch looks reversed<br><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 28, 2016, 10:20 AM bryant <<a href="mailto:3.14472%2Breviews.llvm.org@gmail.com">3.14472+reviews.llvm.org@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">bryant created this revision.<br class="gmail_msg">
bryant added reviewers: george.burgess.iv, dberlin.<br class="gmail_msg">
bryant added a subscriber: llvm-commits.<br class="gmail_msg">
bryant set the repository for this revision to rL LLVM.<br class="gmail_msg">
<br class="gmail_msg">
>From what I understand so far, `getClobberingMemoryAccess` isn't supposed to modify its `MemoryLocation` argument. Making this argument const permits callers to pass xvalues, such as:<br class="gmail_msg">
<br class="gmail_msg">
MemoryAccess *Start;<br class="gmail_msg">
MemCpyInst *M;<br class="gmail_msg">
...<br class="gmail_msg">
MSSA->getWalker()->getClobberingMemoryAccess(Start, MemoryLocation::getForSource(M));<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Repository:<br class="gmail_msg">
rL LLVM<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D26086" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D26086</a><br class="gmail_msg">
<br class="gmail_msg">
Files:<br class="gmail_msg">
include/llvm/Transforms/Utils/MemorySSA.h<br class="gmail_msg">
lib/Transforms/Utils/MemorySSA.cpp<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Index: lib/Transforms/Utils/MemorySSA.cpp<br class="gmail_msg">
===================================================================<br class="gmail_msg">
--- lib/Transforms/Utils/MemorySSA.cpp<br class="gmail_msg">
+++ lib/Transforms/Utils/MemorySSA.cpp<br class="gmail_msg">
@@ -1097,7 +1097,7 @@<br class="gmail_msg">
using MemorySSAWalker::getClobberingMemoryAccess;<br class="gmail_msg">
MemoryAccess *getClobberingMemoryAccess(MemoryAccess *) override;<br class="gmail_msg">
MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,<br class="gmail_msg">
- const MemoryLocation &) override;<br class="gmail_msg">
+ MemoryLocation &) override;<br class="gmail_msg">
void invalidateInfo(MemoryAccess *) override;<br class="gmail_msg">
<br class="gmail_msg">
/// Whether we call resetClobberWalker() after each time we *actually* walk to<br class="gmail_msg">
@@ -2163,7 +2163,7 @@<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
MemoryAccess *MemorySSA::CachingWalker::getClobberingMemoryAccess(<br class="gmail_msg">
- MemoryAccess *StartingAccess, const MemoryLocation &Loc) {<br class="gmail_msg">
+ MemoryAccess *StartingAccess, MemoryLocation &Loc) {<br class="gmail_msg">
if (isa<MemoryPhi>(StartingAccess))<br class="gmail_msg">
return StartingAccess;<br class="gmail_msg">
<br class="gmail_msg">
@@ -2266,7 +2266,7 @@<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
MemoryAccess *DoNothingMemorySSAWalker::getClobberingMemoryAccess(<br class="gmail_msg">
- MemoryAccess *StartingAccess, const MemoryLocation &) {<br class="gmail_msg">
+ MemoryAccess *StartingAccess, MemoryLocation &) {<br class="gmail_msg">
if (auto *Use = dyn_cast<MemoryUseOrDef>(StartingAccess))<br class="gmail_msg">
return Use->getDefiningAccess();<br class="gmail_msg">
return StartingAccess;<br class="gmail_msg">
Index: include/llvm/Transforms/Utils/MemorySSA.h<br class="gmail_msg">
===================================================================<br class="gmail_msg">
--- include/llvm/Transforms/Utils/MemorySSA.h<br class="gmail_msg">
+++ include/llvm/Transforms/Utils/MemorySSA.h<br class="gmail_msg">
@@ -783,7 +783,7 @@<br class="gmail_msg">
/// will return that MemoryDef, whereas the above would return the clobber<br class="gmail_msg">
/// starting from the use side of the memory def.<br class="gmail_msg">
virtual MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,<br class="gmail_msg">
- const MemoryLocation &) = 0;<br class="gmail_msg">
+ MemoryLocation &) = 0;<br class="gmail_msg">
<br class="gmail_msg">
/// \brief Given a memory access, invalidate anything this walker knows about<br class="gmail_msg">
/// that access.<br class="gmail_msg">
@@ -809,7 +809,7 @@<br class="gmail_msg">
using MemorySSAWalker::getClobberingMemoryAccess;<br class="gmail_msg">
MemoryAccess *getClobberingMemoryAccess(MemoryAccess *) override;<br class="gmail_msg">
MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,<br class="gmail_msg">
- const MemoryLocation &) override;<br class="gmail_msg">
+ MemoryLocation &) override;<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
using MemoryAccessPair = std::pair<MemoryAccess *, MemoryLocation>;<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>