Skip to content

[clang] Assertion failed in LoopVectorize.cpp:7401 #111040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cardigan1008 opened this issue Oct 3, 2024 · 1 comment
Closed

[clang] Assertion failed in LoopVectorize.cpp:7401 #111040

cardigan1008 opened this issue Oct 3, 2024 · 1 comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] regression vectorizers

Comments

@cardigan1008
Copy link

When I compiled the code with -O2 flag, it crashed:

#include <stdint.h>
static uint8_t b = 188;
void c();
long d(int e, int p2, short j) {
  long f = 0, a = 1;
  unsigned long g;
  int h;
  if (e < 0 || j < 0)
    return 1;
  h = 0;
  for (; h < p2; h++) {
    a *= j + 1;
    g = e * a;
    f += g % (j + 1);
  }
  if (f < 0)
    return 0;
  return f;
}
void i();
int64_t k() {
  uint32_t l[][8][10] = {0, 4, 7, 1, 4, 3446557846};
  int64_t m[10];
  int h;
  for (h = 0; c + h < 10; h++)
    m[(int)d(5, l[0][0][5] - 3446557842, b - 187) + h] = 1;
  i(m);
  uint8_t *n = &b;
  uint8_t **o;
  o[0] = &n;
}

The crash is:

clang: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7401: 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/hqP8vMG7b

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Oct 3, 2024
@EugeneZelenko EugeneZelenko added vectorizers crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Oct 3, 2024
@shafik
Copy link
Collaborator

shafik commented Oct 3, 2024

This is a regression in trunk: https://godbolt.org/z/a53x7oxhq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] regression vectorizers
Projects
None yet
Development

No branches or pull requests

3 participants