[PATCH] D14688: [Polly] Introduce origin/kind for exit PHI node accesses

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 23:07:42 PST 2015


>> On 11/15/2015 03:44 PM, Michael Kruse wrote:
>> PS: I did not yet get to your earlier patch, but on a quick look I saw you
>> replaced a slightly confusing while/while nest with a C++ iterator
>> based version that is easier to understand. If this change is independent,
>> that would be a nice cleanup that we should probably
>> commit independently.
>
> This is a related change because some of the iterated-over
> MemoryAccesses moved to other lists by that. I did not feel capable to
> adapt the iterator-based version, so I had to rewrite it. It is
> changed again in http://reviews.llvm.org/D13611 .

Right. I unfortunately also have a hard time to understand this piece of 
code. Am I right it is equivalent to:

void ScopStmt::removeMemoryAccesses(MemoryAccessList &InvMAs) {
   // Remove all memory accesses in @p InvMAs from this statement
   // together with all scalar accesses that were caused by them.
   for (MemoryAccess *MA : InvMAs) {
     auto Predicate = [MA](MemoryAccess *Acc) -> bool {
       return (Acc == MA) ||
              (Acc->isWrite() &&
               Acc->getAccessInstruction() ==
               MA->getAccessInstruction());
     };
     MemAccs.erase(std::remove_if(MemAccs.begin(), MemAccs.end(),
                                  Predicate),
                   MemAccs.end());
     InstructionToAccess.erase(MA->getAccessInstruction());
     auto &MAL = *lookupAccessesFor(MA->getAccessInstruction());
     delete &MAL;
   }
}

Tobias


More information about the llvm-commits mailing list