llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.06k stars 11.59k forks source link

[clang] Assertion failed in LoopVectorize #109561

Open cardigan1008 opened 3 hours ago

cardigan1008 commented 3 hours ago

When I compiled this code with O2, it crashed:

long a;
int b;
int c;
long d;
void e() {
  for (int f = 0; f < b; f++)
      d = c > 0 ? a / c : 1;
}

Crash is:

VPIRBasicBlock can only be used as pre-header or a successor of middle-block at the moment!
clang: /root/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8593: void llvm::LoopVectorizationPlanner::buildVPlansWithVPRecipes(llvm::ElementCount, llvm::ElementCount): Assertion `verifyVPlanIsValid(*Plan) && "VPlan is invalid"' failed.

Details can be found here: https://godbolt.org/z/7nhzEWb81

shafik commented 2 hours ago

This looks like a clang trunk regression: https://godbolt.org/z/1d3nvjK9v

Was this a fuzzer generated bug?

cardigan1008 commented 2 hours ago

Was this a fuzzer generated bug?

Yes, I’m currently working on a new fuzzing technique. It is inspired by a PLDI’24 paper and its artifact Creal can be found here.