[polly] [polly] Add profitability check for expanded region. (PR #96548)

Huihui Zhang via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 17:09:25 PDT 2024


================
@@ -4,6 +4,12 @@
 ; CHECK:      remark: <unknown>:0:0: SCoP begins here.
 ; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N] -> {  : N <= 2147483647 - M }
 ; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N] -> {  : -2147483648 - M <= N <= 2147483647 - M }
+; CHECK-NEXT: remark: <unknown>:0:0: Use user assumption: [M, N] -> {  : 0 < M <= 100 and -2147483648 - M <= N <= 2147483647 - M }
----------------
huihzhang wrote:

The first heuristic I posted consider region expansion as unprofitable. the 'if' block and loop are treated as separate regions to build scop.
```
 if (N + M == -1)
        C[0][0] = 0;
 // Loop following
```

Now, the updated heuristic looks for additional loops following unprofitable blocks to encourage loop fusion. Region expansion is successful, and restore original behavior.

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


More information about the llvm-commits mailing list