Someone know what this error means? I get the error when I try to disassemble a file written by LLVMWriteBitcodeToFile. When I dump the module using LLVMDumpModule and manually ass开发者_开发百科emble and disassemble the file no error occurs. The module that i am trying to compile (from LLVMDumpModule) looks like:
; ModuleID = 'Test'
define i32 @a(i32) {
entry:
%icmp = icmp eq i32 %0, 1 ; <i1> [#uses=1]
br i1 %icmp, label %_L2, label %_L3
_L1: ; preds = %_L3
ret i32 %0
call void @RAISE(i32 1)
unreachable
_L2: ; preds = %entry
ret i32 1
_L3: ; preds = %entry
br label %_L1
}
declare void @RAISE(i32)
Any clues?
I don't know the error message is displayed for which instruction, but my guess is the
call void @RAISE(i32 1),
and the reason might be that it is after a terminator instruction (the last instruction in a basic block)
ret i32 %0
, and hence no parent BB
I've run into similar symptoms before, as a result of incorrectly constructing the in-memory LLVM objects representing the IR. Play around with the code that originally generated this, and make sure it's not doing anything fishy.
精彩评论