[llvm] [SLP]Improved reduction cost/codegen (PR #118293)
Leandro Lupori via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 06:16:21 PST 2025
luporl wrote:
This patch broke 2 bots:
- https://lab.llvm.org/buildbot/#/builders/4/builds/5019
- https://lab.llvm.org/buildbot/#/builders/143/builds/5429
clang crashes compiling `test-suite/MultiSource/Benchmarks/Prolangs-C/gnugo/endgame.c`:
```
clang-21: /home/leandro.lupori/llvm/llvm/lib/IR/Instructions.cpp:2112: static bool llvm::ShuffleVectorInst::isInsertSubvectorMask(ArrayRef<int>, int, int &, int &): Assertion `!Src0Elts.isZero() && !Src1Elts.isZero() && "2-source shuffle not found"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/leandro.lupori/stage1/bin/clang-21 -cc1 -triple aarch64-unknown-linux-gnu -emit-obj -disable-free -clear-ast-before-backend -main-file-name endgame.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -enable-tlsdesc -target-cpu neoverse-512tvb -target-feature +v8.4a -target-feature +aes -target-feature +bf16 -target-feature +ccdp -target-feature +ccidx -target-feature +ccpp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fullfp16 -target-feature +i8mm -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +rand -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sha2 -target-feature +sha3 -target-feature +sm4 -target-feature +spe -target-feature +ssbs -target-feature +sve -target-abi aapcs -mvscale-max=2 -mvscale-min=2 -debugger-tuning=gdb -fdebug-compilation-dir=/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/sandbox/build/MultiSource/Benchmarks/Prolangs-C/gnugo -fcoverage-compilation-dir=/home/tcwg-buildbot/worker/clang-aarch64-sve-vls/test/sandbox/build/MultiSource/Benchmarks/Prolangs-C/gnugo -sys-header-deps -D NDEBUG -O3 -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -mllvm -treat-scalable-fixed-error-as-warning=false -target-feature +outline-atomics -target-feature -fmv -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c endgame-c4c5c8.c
1. <eof> parser at end of file
2. Optimizer
3. Running pass "function<eager-inv>(float2int,lower-constant-intrinsics,chr,loop(loop-rotate<header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;no-vectorize-forced-only;>,infer-alignment,loop-load-elim,instcombine<max-iterations=1;no-verify-fixpoint>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;no-hoist-loads-stores-with-cond-faulting;sink-common-insts;speculate-blocks;simplify-cond-branch;no-speculate-unpredictables>,slp-vectorizer,vector-combine,instcombine<max-iterations=1;no-verify-fixpoint>,loop-unroll<O3>,transform-warning,sroa<preserve-cfg>,infer-alignment,instcombine<max-iterations=1;no-verify-fixpoint>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;hoist-loads-stores-with-cond-faulting;no-sink-common-insts;speculate-blocks;simplify-cond-branch;speculate-unpredictables>)" on module "endgame-c4c5c8.c"
4. Running pass "vector-combine" on function "endgame"
#0 0x0000b6bdf3972c40 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/leandro.lupori/stage1/bin/clang-21+0x8152c40)
#1 0x0000b6bdf3970b8c llvm::sys::RunSignalHandlers() (/home/leandro.lupori/stage1/bin/clang-21+0x8150b8c)
#2 0x0000b6bdf39732cc SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x0000e69b40ae48f8 (linux-vdso.so.1+0x8f8)
#4 0x0000e69b404cf1f0 __pthread_kill_implementation ./nptl/./nptl/pthread_kill.c:44:76
#5 0x0000e69b4048a67c gsignal ./signal/../sysdeps/posix/raise.c:27:6
#6 0x0000e69b40477130 abort ./stdlib/./stdlib/abort.c:81:7
#7 0x0000e69b40483fd4 __assert_fail_base ./assert/./assert/assert.c:91:7
#8 0x0000e69b4048404c (/lib/aarch64-linux-gnu/libc.so.6+0x3404c)
#9 0x0000b6bdf3333278 llvm::ShuffleVectorInst::isInsertSubvectorMask(llvm::ArrayRef<int>, int, int&, int&) (/home/leandro.lupori/stage1/bin/clang-21+0x7b13278)
#10 0x0000b6bdf12c5b0c llvm::TargetTransformInfoImplCRTPBase<llvm::AArch64TTIImpl>::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) AArch64TargetMachine.cpp:0:0
#11 0x0000b6bdf2bff820 llvm::TargetTransformInfo::getInstructionCost(llvm::User const*, llvm::ArrayRef<llvm::Value const*>, llvm::TargetTransformInfo::TargetCostKind) const (/home/leandro.lupori/stage1/bin/clang-21+0x73df820)
#12 0x0000b6bdf29c67d0 llvm::TargetTransformInfo::getInstructionCost(llvm::User const*, llvm::TargetTransformInfo::TargetCostKind) const CodeMetrics.cpp:0:0
#13 0x0000b6bdf527f8d4 (anonymous namespace)::VectorCombine::run()::$_0::operator()(llvm::Instruction&) const VectorCombine.cpp:0:0
#14 0x0000b6bdf5277e14 llvm::VectorCombinePass::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) (/home/leandro.lupori/stage1/bin/clang-21+0x9a57e14)
...
```
The full stacktrace is available in https://lab.llvm.org/buildbot/#/builders/143/builds/5429/steps/13/logs/stdio (search for `::PrintStackTrace`)
The reproducer is attached.
[repro.zip](https://github.com/user-attachments/files/18800363/repro.zip)
https://github.com/llvm/llvm-project/pull/118293
More information about the llvm-commits
mailing list