pythonic
pythonic

Reputation: 21589

LLVM can't compile from IR

While trying to compile an LLVM IR, like this

 llc main.ll -o main.s && g++ main.s -O3 -o main -pthread

I get the following error. The same thing compiles on my Ubuntu 10 system, but in the CentOS I get the following error. Any idea what is going on here and why LLVM is going mad? And lastly, how to solve this?

llc: /home/schism/llvm/include/llvm/ADT/IntervalMap.h:606: unsigned int llvm::IntervalMapImpl::LeafNode< <template-parameter-1-1>, <template-parameter-1-2>, <anonymous>, <template-parameter-1-4> >::insertFrom(unsigned int&, unsigned int, KeyT, KeyT, ValT) [with KeyT = llvm::SlotIndex, ValT = unsigned int, unsigned int N = 9u, Traits = llvm::IntervalMapInfo<llvm::SlotIndex>]: Assertion `!Traits::stopLess(b, a) && "Invalid interval"' failed.
0  llc             0x0000000000d5009f
1  llc             0x0000000000d50db7
2  libpthread.so.0 0x0000003cfde0ebe0
3  libc.so.6       0x0000003cfce30285 gsignal + 53
4  libc.so.6       0x0000003cfce31d30 abort + 272
5  libc.so.6       0x0000003cfce29706 __assert_fail + 246
6  llc             0x000000000093624c llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u, llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned int, llvm::SlotIndex, llvm::SlotIndex, unsigned int) + 716
7  llc             0x0000000000936a00
8  llc             0x0000000000929898 llvm::SplitEditor::useIntv(llvm::SlotIndex, llvm::SlotIndex) + 88
9  llc             0x000000000092f369 llvm::SplitEditor::splitRegInBlock(llvm::SplitAnalysis::BlockInfo const&, unsigned int, llvm::SlotIndex) + 1513
10 llc             0x00000000008c20ea
11 llc             0x00000000008c3c78
12 llc             0x00000000008c90d1
13 llc             0x00000000008c95ab
14 llc             0x0000000000a06c84 llvm::RegAllocBase::allocatePhysRegs() + 324
15 llc             0x00000000008c4edc
16 llc             0x0000000000880005 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 53
17 llc             0x0000000000ce4c66 llvm::FPPassManager::runOnFunction(llvm::Function&) + 646
18 llc             0x0000000000ce4cfd llvm::FPPassManager::runOnModule(llvm::Module&) + 45
19 llc             0x0000000000ce641c llvm::MPPassManager::runOnModule(llvm::Module&) + 556
20 llc             0x0000000000ce657e llvm::PassManagerImpl::run(llvm::Module&) + 174
21 llc             0x0000000000ce66dd llvm::PassManager::run(llvm::Module&) + 13
22 llc             0x00000000004d0f1b main + 5451
23 libc.so.6       0x0000003cfce1d994 __libc_start_main + 244
24 llc             0x00000000004ce8e9
Stack dump:
0.      Program arguments: llc main.ll -o main.s
1.      Running pass 'Function Pass Manager' on module 'main.ll'.
2.      Running pass 'Greedy Register Allocator' on function '@_Z7InitSimPKcj'
Aborted

Upvotes: 1

Views: 542

Answers (2)

demented hedgehog
demented hedgehog

Reputation: 7538

There's a similar problem to this floating around here somewhere. Answer was to check the versions of gcc and llvm. Turned out one was 32 bit the other 64 bit. ymmv.

Upvotes: 0

Anton Korobeynikov
Anton Korobeynikov

Reputation: 9324

Looks like LLVM is miscompiled by your system compiler. See http://llvm.org/docs/GettingStarted.html#brokengcc for a list of known broken compilers.

The solution is simple - use other version of the compiler (gcc in your case) to compile LLVM.

Upvotes: 4

Related Questions