You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dealing with nested if and while , the codegen context does a terrible job managing basic blocks and how to jump between them.
There is a missing unconditional jump after the phi instruction at the if_exit that should jump into the next basic block
main:->if true
if true
1else2else3
Produces the following LLVM IR:
; ModuleID = 'mod'
source_filename = "mod"definei64@main() {
entry:
brlabel%if
if: ; preds = %entrybri1true, label%then, label%else_body3
then: ; preds = %ifbrlabel%if1brlabel%if_exit4; <= There is two br here
if1: ; preds = %thenbri1true, label%then2, label%else_body
then2: ; preds = %if1brlabel%if_exit
else_body: ; preds = %if1brlabel%if_exit
if_exit: ; preds = %else_body, %then2%phi = phii64 [ 1, %then2 ], [ 2, %else_body ]
; <= There should be a br
else_body3: ; preds = %ifbrlabel%if_exit4
if_exit4: ; preds = %else_body3, %then%phi5 = phii64 [ %phi, %then ], [ 3, %else_body3 ]
reti64%phi5
}
Error: Bug in the generated IR:
Basic Block in function 'main' does not have terminator!
label%if_exit
The text was updated successfully, but these errors were encountered:
When dealing with nested
if
andwhile
, the codegen context does a terrible job managing basic blocks and how to jump between them.There is a missing unconditional jump after the
phi
instruction at theif_exit
that should jump into the next basic blockProduces the following LLVM IR:
The text was updated successfully, but these errors were encountered: