[polly] [Polly] Distribute the innermost point loop of tile over its statements (PR #225844)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 04:22:04 PDT 2026


================
@@ -548,6 +576,114 @@ ScheduleTreeOptimizer::applyTileBandOpt(isl::schedule_node Node) {
   return Node;
 }
 
+isl::schedule_node
+ScheduleTreeOptimizer::distributeInnermostLoop(isl::schedule_node Node,
+                                               const Dependences *D) {
+  if (!isSimpleInnermostBand(Node))
+    return Node;
+
+  // Number the statements in the order of their names, so that the result does
+  // not depend on the order in which isl lists them.
+  isl::union_set Domain = Node.get_domain();
+  SmallVector<isl::set, 8> Stmts;
+  for (isl::set Stmt : Domain.get_set_list())
+    Stmts.push_back(Stmt);
+  unsigned NumStmts = Stmts.size();
+  if (NumStmts < 2)
+    return Node;
+  llvm::sort(Stmts, [](const isl::set &A, const isl::set &B) {
+    return A.get_tuple_name() < B.get_tuple_name();
----------------
Meinersbur wrote:

The tuple name depends on `-polly-use-llvm-names` and whether you use an assertions build of Clang. . If the output does not depend on it, the sorting is unnecessary. If the output depends in this statement order, use the order in `Scop::Stmts`; it is deterministic from the BB iteration order.

https://github.com/llvm/llvm-project/pull/225844


More information about the llvm-commits mailing list