Issue 243780
Summary [Polly] Fallback path disables vectorization, even when the runtime condition is provably false. Causes major slowdown.
Labels new issue
Assignees
Reporter erwinia42
    There was an attempt in pull request #165525 to stop Polly from disabling vectorization on the fallback path if the runtime condition is always False. However, when the final runtime condition is an aggregate of multiple runtime conditions, the pull request doesn't catch if one of them is False, as it only checks for constant RTC.

Example of problem, generated from HeCBench softmax kernel code:
  %29 = icmp eq i64 0, %28
  %30 = and i1 false, %29
  %polly.rtc.overflown = xor i1 %polly.overflow.state, true
  %polly.rtc.result = and i1 %30, %polly.rtc.overflown

%30 is trivially False, thus %polly.rtc.result is trivially false and we will always take the fallback path, However the current check does:

```
auto *CI = dyn_cast<ConstantInt>(RTC);
if (!(CI && CI->isZero())) {
  for (Loop *L : LI.getLoopsInPreorder()) {
    if (S.contains(L))
      addStringMetadataToLoop(L, StringRef("llvm.loop.vectorize.disable"));
  }
}
```

RTC is not a ConstantInt, thus the vectorization is disabled.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to