Closed ltratt closed 2 weeks ago
This has already highlighted that some guards include their condition SSA var in the live var list, and some don't. I don't know why
To me this just means that the guard condition just happens to be a live variable or not. For example
// Condition dies immediately after if and does not need to be deoptimised.
if x == 1 {
...
}
// Condition is live after `if` and needs to be deoptimised.
int c = x == 1;
if c {
...
}
printf("%d", c);
That second idiom seems a very unlikely one in real code to me... Perhaps a more realistic possibility is that the compiler is identifying duplicate conditions? Dunno.
Really? I think it can happen quite often when you pass arguments that you run checks on and foward them to other functions or use them for control flow.
int foo(bool b) {
if (b) {
...
}
...
if(b) {
...
}
bar(b);
}
I think it can happen quite often when you pass arguments that you run checks on and foward them to other functions or use them for control flow.
Aha, yes, using the bool
type like that makes sense! I'm an idiot.
Before we printed and parsed only things like:
without knowing what live variables the guard has in mind. This PR both displays a guards live variables and allows them to be parsed in e.g.:
This has already highlighted that some guards include their condition SSA var in the live var list, and some don't. I don't know why: I'll raise a separate issue for that.