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
export
fn bad_inline_int(reg ptr u64[1] p) -> reg u64 {
reg u64 x = 0;
inline int i = (int)(x * 4);
i *= 2;
x = p.[i];
return x;
}
compiles to a functionally equivalent program. However, it's really unpleasant that we can put a runtime value in an inline int. I'm adding it here for future reference, but also asking the question of whether we want to disallow this in the future.
This causes problems with the RSB checker, because for loop counters must become transient (they may contain runtime variables) and there is no way to protect them.
Also, it entails re-computing the address many times (if we have many accesses like p.[i], the multiplication will be performed ever time).
The text was updated successfully, but these errors were encountered:
Indeed, but we need propagation for this example, which fails in register allocation:
export fn f() -> reg u64 {
reg u64 x;
x = 1;
reg bool cf zf sf of b;
?{cf, zf, sf, of} = #CMP(x, 0);
b = _uGT(of, cf, sf, zf);
reg u64 y;
y = 2;
x = y if b;
return x;
}
because the line with _uGT doesn't have the AT_inline tag. I believe that this is the only way where the propagation part of propagate inline is needed. The example succeeds if we move b inside the ?{ ... }, because pretyping inserts b = _uGT(...); // bool:i, and then propagate inline looks for AT_inline (not for inline variables). I tried naively removing the propagation, but then we can't use ?{ ... }.
This program
compiles to a functionally equivalent program. However, it's really unpleasant that we can put a runtime value in an inline int. I'm adding it here for future reference, but also asking the question of whether we want to disallow this in the future.
This causes problems with the RSB checker, because for loop counters must become transient (they may contain runtime variables) and there is no way to protect them.
Also, it entails re-computing the address many times (if we have many accesses like
p.[i]
, the multiplication will be performed ever time).The text was updated successfully, but these errors were encountered: