[llvm] [VPlan] Unroll VPReplicateRecipe by VF. (PR #142433)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 01:32:40 PDT 2025


mstorsjo wrote:

I'm also seeing failed asserts on the latest git main. Reduced reproducer:
```c
float GammaFactor_f_value;
double pow();
void malloc();
typedef struct {
  float f_black_crush;
  float f_white_crush;
  float f_gamma
} panoramix_gamma_t;
typedef struct {
  char p_lut[][1][6]
} video_splitter_sys_t;
double GammaFactor();
void Open() {
  video_splitter_sys_t *p_sys = malloc;
  panoramix_gamma_t p_gamma[5];
  p_gamma[0].f_black_crush = 255.0;
  for (int i_index2 = 0; i_index2 <= 1000; i_index2++)
    for (int i_plane = 0; i_plane < 5; i_plane++) {
      double f_factor = GammaFactor(&p_gamma[i_plane]);
      float f_lut = i_index2 * f_factor;
      p_sys->p_lut[i_plane][i_index2][0] = f_lut;
    }
}
double GammaFactor(panoramix_gamma_t *g) {
  if (GammaFactor_f_value <= g->f_black_crush)
    return pow(GammaFactor_f_value, 1.0 / g->f_gamma);
  if (g->f_white_crush)
    return pow(0, 1.0 / g->f_gamma);
}
```

Compiled like this:
```console
$ clang -target aarch64-linux-gnu -c -O2 repro.c -fno-math-errno
clang: ../lib/Transforms/Vectorize/VPlanRecipes.cpp:2758: virtual void llvm::VPReplicateRecipe::execute(llvm::VPTransformState&): Assertion `IsSingleScalar && "VPReplicateRecipes outside replicate regions " "must have already been unrolled"' failed.
```


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


More information about the llvm-commits mailing list