[polly] [Polly] Data flow reduction detection to cover more cases (PR #84901)
Karthika Devi C via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 02:43:05 PDT 2024
================
@@ -2568,49 +2579,196 @@ bool checkCandidatePairAccesses(MemoryAccess *LoadMA, MemoryAccess *StoreMA,
// Finally, check if they are no other instructions accessing this memory
isl::map AllAccsRel = LoadAccs.unite(StoreAccs);
AllAccsRel = AllAccsRel.intersect_domain(Domain);
+
isl::set AllAccs = AllAccsRel.range();
+
Valid = !hasIntersectingAccesses(AllAccs, LoadMA, StoreMA, Domain, MemAccs);
LLVM_DEBUG(dbgs() << " == The accessed memory is " << (Valid ? "not " : "")
<< "accessed by other instructions!\n");
}
+
return Valid;
}
-void ScopBuilder::checkForReductions(ScopStmt &Stmt) {
- SmallVector<MemoryAccess *, 2> Loads;
- SmallVector<std::pair<MemoryAccess *, MemoryAccess *>, 4> Candidates;
+/// Perform a data flow analysis on the current basic block to propagate the
+/// uses of loaded values. Then check and mark the memory accesses which are
+/// part of reduction like chains.
+///
+/// NOTE: This assumes independent blocks and breaks otherwise.
----------------
kartcq wrote:
In line 2704, we check for all the binary instructions using this UsedOutsideBlock function as well.
https://github.com/llvm/llvm-project/pull/84901
More information about the llvm-commits
mailing list