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
Compiling the function below currently produces a register spill:
package p
type T [100]int
func f(p *T) {
if g() {
h(0, *p)
} else {
g()
h(1, *p)
}
}
func g() bool
func h(int, T)
This is because h(1, *p) is compiled to OINDREGSP(8) = *p, which is represented in SSA as Move(OffPtr(8, SP), p).
OffPtr(8, SP) is trivially rematerialized on x86 with LEA $8(SP), but we're currently lowering OffPtr to ADDQconst, which is marked as non-rematerializeable because it clobbers flags (unlike LEAQ).
Compiling the function below currently produces a register spill:
This is because
h(1, *p)
is compiled toOINDREGSP(8) = *p
, which is represented in SSA asMove(OffPtr(8, SP), p)
.OffPtr(8, SP)
is trivially rematerialized on x86 withLEA $8(SP)
, but we're currently loweringOffPtr
toADDQconst
, which is marked as non-rematerializeable because it clobbers flags (unlike LEAQ).Distilled from #22558.
/cc @randall77
The text was updated successfully, but these errors were encountered: