[PATCH] D90290: [LoopInterchange] Prevent Loop Interchange for non-affine value store to affine access

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 12:26:59 PST 2020


fhahn added a comment.

Thanks for the update!



================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:970
+    }
+    auto &SubLoops = OutLoop->getSubLoopsVector();
+    for (auto &L : SubLoops) {
----------------
I'm not sure I entirely follow the logic here. Can we just check if the PHI is affine by getting the SCEV and checking if it is an affine addrec? also, we might check sibling loops that are not related by using subloops? (granted, sibling sub-loops are not supported at the moment.) If we would start at InnerLoop and traverse the getParent chain until we reach OuterLoop, we should only visit the relevant loops?

Would it make sense to flip the logic to instead of looking backwards to just iterate over a worklist starting at affine PHIs in inner and outer and then propagate the affine property to all uses and add newly discovered affine nodes to the worklist? Might need a bit of extra logic to deal with nodes where the operands are still pending.

Then we just need to check the set of visited node to see if we are dealing with affine operands for the stores?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90290/new/

https://reviews.llvm.org/D90290



More information about the llvm-commits mailing list