llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.11k stars 12.01k forks source link

""Node emitted out of order - late" assert compiling to WASM #27703

Closed llvmbot closed 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 27329
Resolution FIXED
Resolved on Apr 12, 2016 18:24
Version trunk
OS Windows NT
Attachments Test case with CPP, LL and .s files (with makefile), This is actual testcase! Previous file doesn't have the change that makes it crash.
Reporter LLVM Bugzilla Contributor
CC @dschuff

Extended Description

The attached Basic.ll file will cause this assert in LLC: Assertion failed: I != VRBaseMap.end() && "Node emitted out of order - late", file E:\testcode\llvm\llvm-3.8.0.src\lib\CodeGen\SelectionDAG\InstrEmitter.cpp, line 302

Changing the argument to the Bar function to pass by value, rather than reference makes the assert go away (Basic.works.cpp and Basic.opt.works.ll attached).

Testcase (and makefile showing build steps) attached.

Callstack below

llc.exe!llvm::InstrEmitter::getVR(llvm::SDValue Op, llvm::DenseMap<llvm::SDValue,unsigned int,llvm::DenseMapInfo,llvm::detail::DenseMapPair<llvm::SDValue,unsigned int> > & VRBaseMap) Line 302 C++ llc.exe!llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode Node, bool IsClone, bool IsCloned, llvm::DenseMap<llvm::SDValue,unsigned int,llvm::DenseMapInfo,llvm::detail::DenseMapPair<llvm::SDValue,unsigned int> > & VRBaseMap) Line 901 C++ llc.exe!llvm::InstrEmitter::EmitNode(llvm::SDNode Node, bool IsClone, bool IsCloned, llvm::DenseMap<llvm::SDValue,unsigned int,llvm::DenseMapInfo,llvm::detail::DenseMapPair<llvm::SDValue,unsigned int> > & VRBaseMap) Line 124 C++ llc.exe!llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,llvm::ilist_iterator > & InsertPos) Line 848 C++ llc.exe!llvm::SelectionDAGISel::CodeGenAndEmitDAG() Line 867 C++ llc.exe!llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator Begin, llvm::ilist_iterator End, bool & HadTailCall) Line 669 C++ llc.exe!llvm::SelectionDAGISel::SelectAllBasicBlocks(const llvm::Function & Fn) Line 1362 C++ llc.exe!llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction & mf) Line 507 C++ llc.exe!anonymous namespace'::WebAssemblyDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction & MF) Line 55 C++ llc.exe!llvm::MachineFunctionPass::runOnFunction(llvm::Function & F) Line 44 C++ llc.exe!llvm::FPPassManager::runOnFunction(llvm::Function & F) Line 1550 C++ llc.exe!llvm::FPPassManager::runOnModule(llvm::Module & M) Line 1571 C++ llc.exe!anonymous namespace'::MPPassManager::runOnModule(llvm::Module & M) Line 1627 C++ llc.exe!llvm::legacy::PassManagerImpl::run(llvm::Module & M) Line 1730 C++ llc.exe!llvm::legacy::PassManager::run(llvm::Module & M) Line 1762 C++ llc.exe!compileModule(char argv, llvm::LLVMContext & Context) Line 408 C++ llc.exe!main(int argc, char argv) Line 211 C++

dschuff commented 8 years ago

It turns out this code is generated by LLVM 3.8. The stackpointer lowering code in particular is much improved since then. You should just use tip of tree for WebAssembly, as there has been a lot of development still going on,and we expect plenty more.

llvmbot commented 8 years ago

Note first testcase added in error! Use second file.

llvmbot commented 8 years ago

assigned to @dschuff