[PATCH] D26086: [MemorySSA] Const correctness. NFC.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 10:41:26 PDT 2016


(but otherwise, assuming you are adding const, LGTM)

On Fri, Oct 28, 2016 at 10:30 AM, Daniel Berlin <dberlin at dberlin.org> wrote:

> This patch looks reversed
>
>
> On Fri, Oct 28, 2016, 10:20 AM bryant <3.14472+reviews.llvm.org at gmail.com>
> wrote:
>
>> bryant created this revision.
>> bryant added reviewers: george.burgess.iv, dberlin.
>> bryant added a subscriber: llvm-commits.
>> bryant set the repository for this revision to rL LLVM.
>>
>> 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:
>>
>>   MemoryAccess *Start;
>>   MemCpyInst *M;
>>   ...
>>   MSSA->getWalker()->getClobberingMemoryAccess(Start,
>> MemoryLocation::getForSource(M));
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D26086
>>
>> Files:
>>   include/llvm/Transforms/Utils/MemorySSA.h
>>   lib/Transforms/Utils/MemorySSA.cpp
>>
>>
>> Index: lib/Transforms/Utils/MemorySSA.cpp
>> ===================================================================
>> --- lib/Transforms/Utils/MemorySSA.cpp
>> +++ lib/Transforms/Utils/MemorySSA.cpp
>> @@ -1097,7 +1097,7 @@
>>    using MemorySSAWalker::getClobberingMemoryAccess;
>>    MemoryAccess *getClobberingMemoryAccess(MemoryAccess *) override;
>>    MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
>> -                                          const MemoryLocation &)
>> override;
>> +                                          MemoryLocation &) override;
>>    void invalidateInfo(MemoryAccess *) override;
>>
>>    /// Whether we call resetClobberWalker() after each time we *actually*
>> walk to
>> @@ -2163,7 +2163,7 @@
>>  }
>>
>>  MemoryAccess *MemorySSA::CachingWalker::getClobberingMemoryAccess(
>> -    MemoryAccess *StartingAccess, const MemoryLocation &Loc) {
>> +    MemoryAccess *StartingAccess, MemoryLocation &Loc) {
>>    if (isa<MemoryPhi>(StartingAccess))
>>      return StartingAccess;
>>
>> @@ -2266,7 +2266,7 @@
>>  }
>>
>>  MemoryAccess *DoNothingMemorySSAWalker::getClobberingMemoryAccess(
>> -    MemoryAccess *StartingAccess, const MemoryLocation &) {
>> +    MemoryAccess *StartingAccess, MemoryLocation &) {
>>    if (auto *Use = dyn_cast<MemoryUseOrDef>(StartingAccess))
>>      return Use->getDefiningAccess();
>>    return StartingAccess;
>> Index: include/llvm/Transforms/Utils/MemorySSA.h
>> ===================================================================
>> --- include/llvm/Transforms/Utils/MemorySSA.h
>> +++ include/llvm/Transforms/Utils/MemorySSA.h
>> @@ -783,7 +783,7 @@
>>    /// will return that MemoryDef, whereas the above would return the
>> clobber
>>    /// starting from the use side of  the memory def.
>>    virtual MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
>> -                                                  const MemoryLocation
>> &) = 0;
>> +                                                  MemoryLocation &) = 0;
>>
>>    /// \brief Given a memory access, invalidate anything this walker
>> knows about
>>    /// that access.
>> @@ -809,7 +809,7 @@
>>    using MemorySSAWalker::getClobberingMemoryAccess;
>>    MemoryAccess *getClobberingMemoryAccess(MemoryAccess *) override;
>>    MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
>> -                                          const MemoryLocation &)
>> override;
>> +                                          MemoryLocation &) override;
>>  };
>>
>>  using MemoryAccessPair = std::pair<MemoryAccess *, MemoryLocation>;
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161028/fa8a9e1c/attachment.html>


More information about the llvm-commits mailing list