我在使用llvm 编写一个编译器,成功的生成了一定的llvm ir ,但是在生成可执行文件的时候遇到了一些问题。
错误显示为:
Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /Users/li/code/src_llvm/include/llvm/Support/Casting.h, line 95.
Abort trap: 6
下面是产生错误的ir:
@0 = global double 0.000000e+00
define double @main() {
entry:
store double 2.000000e+00, double* @0
%a = load double, double* @0
%cmptmp = fcmp ult double 1.000000e+00, %a
%booltmp = uitofp i1 %cmptmp to double
%ifcond = fcmp one double %booltmp, 0.000000e+00
br i1 %ifcond, label %then, label %else
then: ; preds = %entry
%a1 = load double, double* @0
%addtmp = fadd double %a1, 1.000000e+00
store double %addtmp, double* @0
br label %ifcont
else: ; preds = %entry
%a2 = load double, double* @0
%subtmp = fsub double %a2, 1.000000e+00
store double %subtmp, double* @0
br label %ifcont
ifcont: ; preds = %else, %then
ret double 0.000000e+00
}
请问这段ir的哪里有问题
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…