2017-04-06 52 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