ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
28 stars 7 forks source link

Some guards contain their condition as a live variable but some don't #1272

Closed ltratt closed 2 weeks ago

ltratt commented 3 weeks ago

In a PR to print out / parse guard live variables (coming soon) I noticed that some guards have their condition SSA var in the live vars but some don't. Here's (elided) jit-pre-opt output for simple_interp_loop2:

--- Begin jit-pre-opt ---
...
    %14: i1 = eq %13, 0i32
    guard true, %14, [%0, %3, %4, %5, %6, %7, %8, %9, %14]
...
    %18: i1 = eq %17, 3i32
    guard false, %18, [%0, %3, %4, %5, %6, %7, %8, %9, %18]
...
    %35: i1 = eq %23, 0i32
    guard true, %35, [%0, %3, %4, %5, %6, %7, %8, %9, %23]

Note that the first two guards end with their condition SSA var (%14 and %18 respectively) but the third guard doesn't include %35. Note that none of the three condition variables is used later in the trace, so I was (naively?) expecting all, or none, of them to appear -- but a mix seems weird.

ltratt commented 2 weeks ago

We have a plausible explanation for this (see #1273).