| Issue |
241918
|
| Summary |
[LoopVectorize] assertion failure "Element type of a VectorType must be an integer/fp/pointer/valid target extension type."
|
| Labels |
generated by fuzzer
|
| Assignees |
|
| Reporter |
hazohelet
|
Live Reproducer: https://godbolt.org/z/M68xqjh1a
Compiling the following C code for `x86_64` with `clang -O2` crashes with assertion failure.
```c
static int g;
int f(void) {
int l, r;
for (int i = 0; i < 14; i++) {
l = g ? 2147483647 % g : 1;
switch (__builtin_add_overflow(l, 1, &r) ? l : r)
case 0:
case 2:
l = 0;
}
return l;
}
void h(void) {
for (unsigned i = 0;; i++)
g = i;
}
```
clang command:
```sh
clang -O2 -c repro.c
```
The compiler crashes with the following output:
```
clang: /home/runner/work/ccput/ccput/llvm/llvm/lib/IR/Type.cpp:845: static llvm::FixedVectorType* llvm::FixedVectorType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(ElementType) && "Element type of a VectorType must " "be an integer, floating point, " "pointer type, or a valid target " "extension type."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: clang -O2 -c repro.c
1. <eof> parser at end of file
2. Optimizer
3. Running pass "function<eager-inv>(...)" on module "repro.c"
4. Running pass "loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>" on function "f"
...
#11 llvm::FixedVectorType::get(llvm::Type*, unsigned int)
#12 llvm::IRBuilderBase::CreateVectorSplat(llvm::ElementCount, llvm::Value*, llvm::Twine const&)
#13 llvm::VPTransformState::get(llvm::VPValue const*, bool)
#14 llvm::VPWidenRecipe::execute(llvm::VPTransformState&)
#15 llvm::VPBasicBlock::executeRecipes(llvm::VPTransformState*, llvm::BasicBlock*)
#16 llvm::VPBasicBlock::execute(llvm::VPTransformState*)
#17 llvm::VPlan::execute(llvm::VPTransformState*)
#18 llvm::LoopVectorizationPlanner::executePlan(llvm::ElementCount, unsigned int, llvm::VPlan&, bool, llvm::LoopVectorizationPlanner::EpilogueVectorizationKind, llvm::MutableArrayRef<llvm::VPBasicBlock*>)
#19 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
```
Notes:
* Also crashes at -Os, and for `--target=i686-linux-gnu` and `--target=aarch64-linux-gnu`
* Compiles at -O1, -O3 and -Oz, and with `-fno-vectorize`
* same assertion and mostly same stack trace with #176663, which is closed, so I suppose this is showing unfixed part of the bug
clang version:
```text
clang version 24.0.0git (https://github.com/llvm/llvm-project 7d25e4f9cd72686727beaf0b661ce3e910ee1349)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs