[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 02:19:13 PDT 2025
================
@@ -542,10 +619,23 @@ namespace llvm {
/// e - 5
/// f - 6
/// g - 7 = MaxLevels
- void establishNestingLevels(const Instruction *Src,
- const Instruction *Dst);
-
- unsigned CommonLevels, SrcLevels, MaxLevels;
+ /// SeparateLevels counts the number of levels after common levels that are
+ /// not common but are similar, meaning that they have the same tripcount
+ /// and depth. Assume that in this code fragment, levels c and e are
+ /// similar. In this case only the loop nests at the next level after
+ /// common levels are similar, and SeparateLevel is set to 1.
+ /// If there are similar loop nests, we could use the APIs with considering
+ /// them as fused loops. In that case the level numbers for the previous
+ /// code look like
+ /// a - 1
+ /// b - 2
+ /// c,e - 3 = CommonLevels
+ /// d - 4 = SrcLevels
+ /// f - 5
+ /// g - 6 = MaxLevels
----------------
Meinersbur wrote:
> I ran llvm-test-suit and got no error. Could you please double check the tests? If you still have test failures let me know the exact steps to run and get the error please. Thanks.
@kasuga-fj is correct, I manually added print-da to the optimization pipeline. I should run on everything, not just on functions that a loop pass intends to analyze. The concrete patch I used is https://github.com/llvm/llvm-project/compare/main...Meinersbur:llvm-project:llvm_da-print
Another possibility would be to use a shell script such as
```
#! /bin/bash
clang "$@" -emit-llvm -o - | opt -passes='print<da>'
clang "$@"
```
as CMAKE_C(XX)_COMPILER for llvm-test-suite, and diff output with and without the patch. https://github.com/Meinersbur/llvm-project/tree/llvm_da-print puts it into different files so it can still run in parallel, and the print pass is at the right position.
https://github.com/llvm/llvm-project/pull/128782
More information about the llvm-commits
mailing list