-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Reproducer: https://godbolt.org/z/K6Y11T61M
Testcase (reduced from a valid C program with _BitInt):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-musl"
define i32 @backsmith_pure_3() {
entry:
%0 = zext <4 x i21> zeroinitializer to <4 x i32>
%1 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %0)
ret i32 %1
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #0
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }llc output:
llc: /root/llvm-project/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:1413: virtual llvm::MachineInstrBuilder llvm::MachineIRBuilder::buildInstr(unsigned int, llvm::ArrayRef<llvm::DstOp>, llvm::ArrayRef<llvm::SrcOp>, std::optional<unsigned int>): Assertion `SrcOps[0].getLLTTy(*getMRI()).getElementType() == DstOps[0].getLLTTy(*getMRI()) && "Type mismatch"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -global-isel -O1 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'AArch64PreLegalizerCombiner' on function '@backsmith_pure_3'
#0 0x00000000041c2638 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x41c2638)
#1 0x00000000041bf4e4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#2 0x0000729a58242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000729a582969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#4 0x0000729a58242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#5 0x0000729a582287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#6 0x0000729a5822871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#7 0x0000729a58239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#8 0x00000000048aed7b llvm::MachineIRBuilder::buildInstr(unsigned int, llvm::ArrayRef<llvm::DstOp>, llvm::ArrayRef<llvm::SrcOp>, std::optional<unsigned int>) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x48aed7b)
#9 0x0000000004786cc3 llvm::CSEMIRBuilder::buildInstr(unsigned int, llvm::ArrayRef<llvm::DstOp>, llvm::ArrayRef<llvm::SrcOp>, std::optional<unsigned int>) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4786cc3)
#10 0x0000000000c38d23 (anonymous namespace)::AArch64PreLegalizerCombinerImpl::runCustomAction(unsigned int, llvm::GIMatchTableExecutor::MatcherState const&, llvm::SmallVector<llvm::MachineInstrBuilder, 4u>&) const AArch64PreLegalizerCombiner.cpp:0:0
#11 0x0000000000c3eb1b bool llvm::GIMatchTableExecutor::executeMatchTable<(anonymous namespace)::AArch64PreLegalizerCombinerImpl const, llvm::Bitset<1u>, std::optional<llvm::SmallVector<std::function<void (llvm::MachineInstrBuilder&)>, 4u>> ((anonymous namespace)::AArch64PreLegalizerCombinerImpl::*)(llvm::MachineOperand&) const, void ((anonymous namespace)::AArch64PreLegalizerCombinerImpl::*)(llvm::MachineInstrBuilder&, llvm::MachineInstr const&, int) const>((anonymous namespace)::AArch64PreLegalizerCombinerImpl const&, llvm::GIMatchTableExecutor::MatcherState&, llvm::GIMatchTableExecutor::ExecInfoTy<llvm::Bitset<1u>, std::optional<llvm::SmallVector<std::function<void (llvm::MachineInstrBuilder&)>, 4u>> ((anonymous namespace)::AArch64PreLegalizerCombinerImpl::*)(llvm::MachineOperand&) const, void ((anonymous namespace)::AArch64PreLegalizerCombinerImpl::*)(llvm::MachineInstrBuilder&, llvm::MachineInstr const&, int) const> const&, llvm::MachineIRBuilder&, unsigned char const*, llvm::TargetInstrInfo const&, llvm::MachineRegisterInfo&, llvm::TargetRegisterInfo const&, llvm::RegisterBankInfo const&, llvm::Bitset<1u> const&, llvm::CodeGenCoverage*) const (.constprop.0) AArch64PreLegalizerCombiner.cpp:0:0
#12 0x0000000000c4a891 (anonymous namespace)::AArch64PreLegalizerCombinerImpl::tryCombineAll(llvm::MachineInstr&) const AArch64PreLegalizerCombiner.cpp:0:0
#13 0x0000000004796e79 llvm::Combiner::combineMachineInstrs() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4796e79)
#14 0x0000000000c4b20f (anonymous namespace)::AArch64PreLegalizerCombiner::runOnMachineFunction(llvm::MachineFunction&) (.part.0) AArch64PreLegalizerCombiner.cpp:0:0
#15 0x00000000030a1219 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x00000000036f0a06 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f0a06)
#17 0x00000000036f0db1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f0db1)
#18 0x00000000036f161f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36f161f)
#19 0x00000000008fca42 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#20 0x00000000007c84f9 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c84f9)
#21 0x0000729a58229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x0000729a58229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x00000000008f1275 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f1275)
Program terminated with signal: SIGSEGV
Compiler returned: 139