Created attachment 3354 [details] ZIP archive with C and BC files Two errors, depending on optimization level. LLVM r79531.
No crash with -regalloc=simple, but wrong is generated.
(In reply to comment #1) Wrong code, I mean. :)
Is this still broken with tot?
In r96110: $ llc -regalloc=linearscan bug-O1.bc llc: /tmp/llvm/lib/CodeGen/RegAllocLinearScan.cpp:1183: void<unnamed>::RALinScan::assignRegOrStackSlotAtInterval(llvm::LiveInterval*): Assertion `false && "Ran out of registers during register allocation!"' failed. 0 llc 0x08764913 Stack dump: 0. Program arguments: llc -regalloc=linearscan bug-O1.bc 1. Running pass 'Linear Scan Register Allocator' on function '@g' Aborted $ llc -regalloc=local bug-O1.bc LLVM ERROR: Ran out of registers during register allocation! Please check your inline asm statement for invalid constraints: INLINEASM <es:push $0 call ${1:a} pop %edx>, 11, %EBP<kill>, 11, %EBP<kill>, 14, %AX<earlyclobber,def,dead>, 14, %BX<earlyclobber,def,dead>, 14, %CX<earlyclobber,def,dead>, 14, %DX<earlyclobber,def,dead>, 14, %SI<earlyclobber,def,dead>, 14, %DI<earlyclobber,def,dead>, 14, %EFLAGS<earlyclobber,def,dead> $ llc -regalloc=pbqp bug-O1.bc llc: /tmp/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1668: std::vector<llvm::LiveInterval*, std::allocator<llvm::LiveInterval*> > llvm::LiveIntervals::addIntervalsForSpills(const llvm::LiveInterval&, llvm::SmallVectorImpl<llvm::LiveInterval*>&, const llvm::MachineLoopInfo*, llvm::VirtRegMap&): Assertion `li.weight != (__builtin_huge_valf()) && "attempt to spill already spilled interval!"' failed. 0 llc 0x08764913 Stack dump: 0. Program arguments: llc -regalloc=pbqp bug-O1.bc 1. Running pass 'PBQP Register Allocator' on function '@g' Aborted
I believe this is fixed as of 106893. (Note that &f is not valid with "i" in PIC modes, as the address cannot be computed at linktime.)
&f should actually work with "i" in RIP-relative mode, which is default on Darwin x86-64. Fixed in 107727.