2017-04-06 110 views
0

當我執行以下IR:LLVM - '!NodePtr-> isKnownSentinel(),函數運算符*'是什麼意思?

declare void @_puts(i32, ...) 

define void @main() { 
entry: 
    %name = alloca i32 
    br i1 true, label %then, label %else 

then:            ; preds = %entry 
    call void (i32, ...) @_puts(i32 1, i32 1234) 
    br label %end 

else:            ; preds = %entry 
    br label %end 

end:            ; preds = %else, %then 
    %if_val = phi i32 [ 1234, %then ], [ 0, %else ] 

entry1:           ; No predecessors! 
    store i32 %if_val, i32* %name 
    %name2 = load i32, i32* %name 
    call void (i32, ...) @_puts(i32 1, i32 %name2) 
    ret void 
} 

我得到了以下錯誤消息:

斷言失敗:,函數operator *,文件/用戶/ MAC/llvm-(NodePtr-> isKnownSentinel()!)源極/ LLVM /包含/ LLVM/ADT/ilist_iterator.h,線139

中止陷阱:6

是什麼消息意味着?

任何人都可以解釋這對我嗎?

非常感謝。

回答

1

該消息指的是simple_ilistsentinel node,它是一個數據結構,用於表示模塊中函數列表,函數中的基本塊,基本塊中的指令等等。哨兵節點表示列表的結尾,並且是這些列表的唯一數據成員 - 其餘部分位於構成列表的對象內(「i」表示「侵入」)。

我想這個消息是由遍歷simple_ilist的末尾迭代引起的。最有可能是持有end塊中的指令的人,因爲這是唯一被格式錯誤的塊。您可以通過添加終止符來修復它:

end:            ; preds = %else, %then 
    %if_val = phi i32 [ 1234, %then ], [ 0, %else ] 
    br label %entry1