Skip to content

Assertion failed: (TmpVec.size() > 1), function buildUnmerge, llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp, line 609 #47532

@shepmaster

Description

@shepmaster
Bugzilla Link 48188
Resolution FIXED
Resolved on Mar 05, 2021 09:38
Version 11.0
OS MacOS X
Blocks #48246
Attachments LLVM IR to reproduce the crash
CC @Dushistov,@RKSimon,@nikic,@qcolombet
Fixed by commit(s) c35761d 52510d8

Extended Description

 % ./bin/llc ../build/bugpoint-reduced-simplified.ll -filetype=obj -mcpu=apple-a12 -march=arm64 -O0 Assertion failed: (TmpVec.size() > 1), function buildUnmerge, file /Users/shepmaster/Projects/llvm-project/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp, line 609. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace. Stack dump: 0. Program arguments: ./bin/llc ../build/bugpoint-reduced-simplified.ll -filetype=obj -mcpu=apple-a12 -march=arm64 -O0 1. Running pass 'Function Pass Manager' on module '../build/bugpoint-reduced-simplified.ll'. 2. Running pass 'Legalizer' on function '@_ZN3std2io5stdio8print_to17h83af8c48359573cfE' 0 llc 0x0000000106c22658 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 76 1 llc 0x0000000106c22b68 PrintStackTraceSignalHandler(void*) + 32 2 llc 0x0000000106c20bd8 llvm::sys::RunSignalHandlers() + 124 3 llc 0x0000000106c24ac4 SignalHandler(int) + 208 4 libsystem_platform.dylib 0x000000018941cc44 _sigtramp + 56 5 libsystem_pthread.dylib 0x00000001893d4c24 pthread_kill + 292 6 libsystem_c.dylib 0x000000018931c864 abort + 104 7 libsystem_c.dylib 0x000000018931bb68 err + 0 8 llc 0x000000010729d1dc llvm::MachineIRBuilder::buildUnmerge(llvm::ArrayRef<llvm::Register>, llvm::SrcOp const&) + 168 9 llc 0x000000010724c894 llvm::LegalizerHelper::extractParts(llvm::Register, llvm::LLT, int, llvm::SmallVectorImpl<llvm::Register>&) + 248 10 llc 0x0000000107244c08 llvm::LegalizerHelper::narrowScalar(llvm::MachineInstr&, unsigned int, llvm::LLT) + 8564 11 llc 0x0000000107241ec0 llvm::LegalizerHelper::legalizeInstrStep(llvm::MachineInstr&) + 492 12 llc 0x000000010722bf48 llvm::Legalizer::legalizeMachineFunction(llvm::MachineFunction&, llvm::LegalizerInfo const&, llvm::ArrayRef<llvm::GISelChangeObserver*>, llvm::LostDebugLocObserver&, llvm::MachineIRBuilder&) + 1104 13 llc 0x000000010722da2c llvm::Legalizer::runOnMachineFunction(llvm::MachineFunction&) + 964 14 llc 0x000000010552ce70 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 460 15 llc 0x0000000105d4a29c llvm::FPPassManager::runOnFunction(llvm::Function&) + 548 16 llc 0x0000000105d51a68 llvm::FPPassManager::runOnModule(llvm::Module&) + 116 17 llc 0x0000000105d4ab08 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) + 688 18 llc 0x0000000105d4a6a0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 272 19 llc 0x0000000105d51e84 llvm::legacy::PassManager::run(llvm::Module&) + 36 20 llc 0x0000000104597258 compileModule(char**, llvm::LLVMContext&) + 5304 21 llc 0x0000000104595590 main + 1288 22 libdyld.dylib 0x00000001893f0f54 start + 4 

Doing some light debugging, I see that NumParts is 1; this is what triggers the assertion. This is computed from SizeOp0 / NarrowSize when SizeOp0 is 120 and NarrowSize is 64.

The Rust fork is currently at 2e10b7a. git-bisect says that the attached LLVM IR compiles successfully starting at db464a3.

However, I don't believe that the bug is actually fixed, merely hidden. The commit in question performs more transformations to the code and causes SizeOp0 to be 128. When I cherry-picked that commit back to the Rust fork, the problems continue to manifest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions