-
Notifications
You must be signed in to change notification settings - Fork 85
Remove Cifthenelse #3859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Remove Cifthenelse #3859
Conversation
This is based on #3855 |
73291b8
to
90bcf2a
Compare
Ah but the first bullet point isn't quite right: the " |
8f6f4ae
to
1bcc5b7
Compare
1bcc5b7
to
08f8ff9
Compare
@@ -871,6 +871,11 @@ let[@inline] get_const = function | |||
| Cconst_natint (i, _) -> Some i | |||
| _ -> None | |||
|
|||
let ifthenelse (cond, then_dbg, then_, else_dbg, else_, dbg) = | |||
(* This case is matched on in [Cfg_selection] *) | |||
let cond = tag_int (Cop (Ccmpi Cne, [cond; Cconst_int (1, dbg)], dbg)) dbg in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need tag_int
around this expression?
This is to bring the Cmm language further in line with Flambda 2.
I think this should be ok, but will look at the generated code. Two problems might be:
Cmm_helpers.ifthenelse
, what will happen? This should be fine if the results of e.g.Iinttest
are in{0, 1}
, but is that guaranteed?Cswitch
on{0, 1}
gets caught by the new pattern in instruction selection, will the code be worse? It's unclear such a switch would ever be generated anyway (seeTo_cmm_expr.switch
).