Issue 109528
Summary [clang] Assertion failed in Vectorize
Labels clang
Assignees
Reporter cardigan1008
    When I compiled this code with O2 flag, it crashed:

```c
#include <stdint.h>
static uint64_t
safe_sub_func_uint64_t_u_u(uint64_t ui1, uint64_t ui2)
{
  return ui1 - ui2;
}
long a;
static int8_t c;
void b(long d, int f) {
  int e = 0;
  for (; e < 64; e++)
 if (e - f)
      a |= e >> f;
    else
      a |= d & e;
}
uint32_t g() {
  b(6, c);
  for (;; c = safe_sub_func_uint64_t_u_u(c, 4))
    ;
}
```

The crash is:
```
clang: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7383: 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.
```

Details can be found here: https://godbolt.org/z/7733x1hvP
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to