[PATCH] D49125: [ARM] ParallelDSP: multiple reduction stmts in loop

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 09:44:39 PDT 2018


samparker added a comment.

I still think you're overcomplicating things here... Keeping the ReadOnly flag, you can then just check what's writing to memory in the rest of the block:

  static void AliasCandidates(BasicBlock *Header,
                              Instructions &Reads, Instructions &Writes) {
    for (auto &I : *Header) {
      if (I.mayReadFromMemory())
        Reads.push_back(&I);
      if (I.mayWriteToMemory())
        Writes.push_back(&I);
    }
  }
  
  static bool AreAliased(AliasAnalysis *AA, Instructions &Reads,
                         Instructions &Writes,
                         ParallelMACList &MACCandidates) {
    LLVM_DEBUG(dbgs() << "Alias checks:\n");
    for (auto &MAC : MACCandidates) {
      LLVM_DEBUG(dbgs() << "mul: "; MAC.Mul->dump());
      if (!MAC.isReadOnly)
        return true;
      for (auto *I : Writes) {
        LLVM_DEBUG(dbgs() << "- "; I->dump());
        assert(MAC.MemLocs.size() >= 2 && "expecting at least 2 memlocs");
        for (auto &MemLoc : MAC.MemLocs) {
          if (isModOrRefSet(intersectModRef(AA->getModRefInfo(I, MemLoc),
                                            ModRefInfo::ModRef))) {
            LLVM_DEBUG(dbgs() << "Yes, aliases found\n");
            return true;
          }
        }
      }
    }
    return false;
  }

As before, this will allow each MAC chain to be processed independently (which makes sense because they are independent) and allows us to be continue being assumption free. I'm sorry this removes the for_each loop though :p


https://reviews.llvm.org/D49125





More information about the llvm-commits mailing list