Hi,I'm generating IR for a factorial function that looks like below. When I call the verifyFunction, it fails validation with the error message Terminator found in the middle of a basic block. label %then
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Nothing is executed after a ret instruction, violating the definition
of a basic block (executes all instructions from beginning to end).
Passes are not expecting this situation; if something still works, it
is pure luck.
Just remove the br instruction, it's not executed anyway.
Michael
> ifcont: ; preds = %then, %entry
> %n3 = load double, double* %n1, align 8
> %n4 = load double, double* %n1, align 8
> %subtmp = fsub double %n4, 1.000000e+00
> %calltmp = call double @fact(double %subtmp)
> %multmp = fmul double %n3, %calltmp
> ret double %multmp
> }
> Validating function...
> Terminator found in the middle of a basic block!
> label %then
> Validation failed