What do arrow statements in CLIF mean?
eg
function %mul_minus_one_commuted(i32) -> i32 {
block0(v0: i32):
v1 = iconst.i32 0xffff_ffff ; -1
v2 = imul v1, v0
return v2
; check: v3 = ineg v0
; check: v5 -> v3
; check: v6 -> v3
; check: return v3
}
Those are value aliases, so v5
is an alias of v3
, and so on.
Ok. But why do the aliases exist in the first place?
they allow for rewrites without editing all use-sites
I see. So at some point a v5
and v6
were referenced somewhere?
presumably in intermediate forms in the e-graph, but which were ultimately not selected during extraction
cool
maybe we could remove dead aliases from IR before its emitted? Would make more concise/readable output
That would lose information. It is possible to replace an alias with another alias or a regular instruction again.
yes, it's useful to have a 1:1 dump of the actual IR data structure; if it becomes an issue for readable dumps at various points I suppose we could have simplification passes (DCE would be another useful one when printing) that can run before debug dumps
We do have resolve_aliases to replace all alias uses with their definition and we also don't print unused aliases, so just calling resolve_aliases before printing would be enough to remove all aliases from the output.
kmeakin has marked this topic as resolved.
Last updated: Nov 22 2024 at 17:03 UTC