LLVM无法从IR编译

时间:2012-03-26 13:52:13

标签: c++ c linux llvm clang

尝试编译LLVM IR时,像这样

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

我收到以下错误。同样的事情在我的Ubuntu 10系统上编译,但在CentOS中我得到以下错误。知道这里发生了什么,为什么LLVM会发疯?最后,如何解决这个问题?

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

2 个答案:

答案 0 :(得分:4)

看起来您的系统编译器错误编译了LLVM。有关已知损坏编译器的列表,请参阅http://llvm.org/docs/GettingStarted.html#brokengcc

解决方案很简单 - 使用其他版本的编译器(在您的情况下为gcc)来编译LLVM。

答案 1 :(得分:0)

这有一个类似的问题,这里漂浮在这里。答案是检查gcc和llvm的版本。原来一个是另外64位的32位。因人而异。