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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 05:11:26 PDT 2024


Meinersbur wrote:

Your current approach is all-or-nothing, i.e. either use the expanded region or none at all. So I think the following is rejected:
```c
for (int i = 0; i < n; ++i)
  A[i] = i;
for (int j = 0; j < n; ++j)
  A[j] = j;
*unrelated = 42; 
```
That is, `expandRegion` is expanding to the j-loop (and remove the i-loop-only SCoP from the cache), then try to expand to `*unrelated` (and remove the i/j-loop-SCoP from the cache), then do your test which is failing and thus remove it from the cache as well. So at the end, not a single SCoP is accepted.

I think your test should be incorporated into the while-loop.

Your `isRegionExpansionProfitable` function can be massively simplified. No need to iterate over all BBs, just get the Exiting blocks and west whether they are in an included loop.

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


More information about the llvm-commits mailing list