[llvm] [VPlan] Implement VPWidenCallRecipe::computeCost (NFCI). (PR #106047)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 01:03:50 PDT 2024


mstorsjo wrote:

I also ran into assert failures with this, on a multitude of architectures. (I would have caught it already yesterday, but my nightly build yesterday was broken due to other reasons, so yesterday's build went untested otherwise.)

It's reproducible with the following snippets:
```c
float *a;
int b;
double fabs();
__attribute__((cold)) int c() {
  for (; b; b++)
    a[b] = 1. - fabs(b);
}
```
```
$ clang -target aarch64-linux-gnu -c -O2 repro.c
clang: ../lib/Transforms/Vectorize/LoopVectorize.cpp:7369: llvm::VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop)) && " VPlan cost model and legacy cost model disagreed"' failed.
```
And:
```c
int *a;
__attribute__((cold)) int b(int c) {
  long d, f;
  double e;
  for (int g = 0; g < c; g++) {
    e = g * 3.14159265358979323846;
    f = e;
    if (f > 0)
      d = 0;
    else
      d = f;
    a[g] = d;
  }
}
```
```
$ clang -target x86_64-w64-mingw32 -c -O2 repro.c
clang: ../lib/Transforms/Vectorize/LoopVectorize.cpp:7369: llvm::VectorizationFactor llvm::LoopVectorizationPlanner::computeBestVF(): Assertion `(BestFactor.Width == LegacyVF.Width || planContainsAdditionalSimplifications(getPlanFor(BestFactor.Width), CostCtx, OrigLoop)) && " VPlan cost model and legacy cost model disagreed"' failed.
```

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


More information about the llvm-commits mailing list