Issue 240454
Summary [AArch64] assertion failure "Illegal Type for Splice" with loop vectorizer and SVE
Labels generated by fuzzer
Assignees
Reporter hazohelet
    Live Reproducer: https://godbolt.org/z/1dxxeP8vW

Compiling the following C code for `aarch64` with `clang -Os -march=armv9-a` crashes with assertion failure.

```c
int f(__int128 s, long t, int n) {
  int x = 0;
  for (int i = 0; i < n; i++) {
    x = s != 0;
    s = t;
  }
  return x;
}
```

clang command:

```sh
clang --target=aarch64-linux-gnu -march=armv9-a -Os -c repro.c
```

The compiler crashes with the following output:

```
clang: /home/runner/work/ccput/ccput/llvm/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:7124: llvm::InstructionCost llvm::AArch64TTIImpl::getSpliceCost(llvm::VectorType*, int, llvm::TargetTransformInfo::TargetCostKind) const: Assertion `Entry && "Illegal Type for Splice"' 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 --target=aarch64-linux-gnu -march=armv9-a -Os -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::AArch64TTIImpl::getSpliceCost(llvm::VectorType*, int, llvm::TargetTransformInfo::TargetCostKind) const
#12 llvm::AArch64TTIImpl::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::VectorType*, llvm::TargetTransformInfo::TargetCostKind, llvm::ArrayRef<int>, int, llvm::Vector...
#13 llvm::TargetTransformInfo::getShuffleCost(llvm::TargetTransformInfo::ShuffleKind, llvm::VectorType*, llvm::VectorType*, llvm::TargetTransformInfo::TargetCostKind, llvm::ArrayRef<int>, int, llvm::V...
#14 llvm::VPInstruction::computeCost(llvm::ElementCount, llvm::VPCostContext&) const
#15 llvm::VPRecipeBase::cost(llvm::ElementCount, llvm::VPCostContext&)
#16 llvm::VPBasicBlock::cost(llvm::ElementCount, llvm::VPCostContext&)
#17 llvm::VPlan::cost(llvm::ElementCount, llvm::VPCostContext&)
#18 llvm::LoopVectorizationPlanner::cost(llvm::VPlan&, llvm::ElementCount, llvm::VPRegisterUsage*, llvm::LoopVectorizationCostModel&) const
#19 llvm::LoopVectorizationPlanner::computeBestVF()
#20 llvm::LoopVectorizePass::processLoop(llvm::Loop*)
```

Notes:

* Also crashes with `-march=armv8-a+sve` and with `-msve-vector-bits=256`
* Compiles at -O1, -O2, -O3 and -Oz, with `-fno-vectorize`, and without SVE

clang version:

```text
clang version 24.0.0git (https://github.com/llvm/llvm-project f5744e07d2dba7367ec68426fd6b6b07e2916b39)
```

This reproduces with current LLVM trunk.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to