phi函数中的类型错误
对于下面的测试用例:
//单个if
int main(){
int a;
if(1) a=1;
return a;
}
生成下面的LLVM IR
define i32 @main( ) {
block0:
%0 = icmp ne i32 1, 0
br i1 %0, label %block1, label %block2
block1:
br label %block2
block2:
%1 = phi i32 [0.000000, %block0], [1, %block1]
br label %block3
block3:
%2 = phi i32 [%1, %block2]
ret i32 %2
}
问题出现在block2的phi函数中:
llc: error: llc: test.ll:8:17: error: floating point constant invalid for type
%1 = phi i32 [0.000000, %block0], [1, %block1]
^
应该是类型转换错误.