[llvm] [DependenceAnalysis] Extending SIV to handle separate loops (PR #128782)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 03:58:48 PDT 2025
================
@@ -523,10 +594,15 @@ namespace llvm {
/// e - 5
/// f - 6
/// g - 7 = MaxLevels
- void establishNestingLevels(const Instruction *Src,
- const Instruction *Dst);
+ /// SeparateLevels counts the number of loop levels after the common levels
+ /// that are not identical but are considered similar. Two levels are
+ /// considered similar if they have the same trip count and the same
+ /// nesting depth.
+ /// For example, if loops `c` and `e` are similar, then they contribute to
+ /// the SeparateLevels count and SeparateLevels is set to 1.
----------------
Meinersbur wrote:
Can you write some about how the interface works for methods that take a "Separate" argument? In this example, c and e are considered similar, which are loops 3 and 5, but with `Separate==true`, to get the result for the fused loop, one passes just 3 (which could be considered either the loop depth which is the same of loop c and e, or the SrcLevels representing the fused loops). The pre-existing use of "level" which is not actually the loop depth (number of surrounding loops it is nested in) but a loop id in depth-first order is a bit unfortunate. Some disambiguation here may help.
[not a change request] Instead of "Separate" I think I would have preferred using something "like AssumeFusedLoops" consistently throughout, but not something that I would required for this review. "Separate" does not convey a lot of meaning, it could be loops from different functions. For methods that don't even make sense for non-fused loop such as `getDistance` (hence `level` should rather mean depth), the parameter isn't strictly nessary, a client that doesn't know about assumed-fused loops would not call it with argument beyond getLevels() anyways.
https://github.com/llvm/llvm-project/pull/128782
More information about the llvm-commits
mailing list