mirror of
https://github.com/golang/go
synced 2024-10-05 19:21:21 -06:00
[dev.ssa] cmd/compile/internal/ssa: large object load/store vs. vardef
VarDef declarations are getting in the way of rewriting load/store pairs into moves. This change fixes that, albeit in a really hacky way. Better options would be appreciated. Increases coverage during make.bash from 67% to 71%. Change-Id: I336e967687e2238c7d0d64e3b37132a731ad15c3 Reviewed-on: https://go-review.googlesource.com/14347 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
6bf383c7b3
commit
3fa0a75a02
@ -179,6 +179,7 @@
|
|||||||
|
|
||||||
// big-object moves (TODO: remove?)
|
// big-object moves (TODO: remove?)
|
||||||
(Store [size] dst (Load src mem) mem) && size > config.IntSize -> (Move [size] dst src mem)
|
(Store [size] dst (Load src mem) mem) && size > config.IntSize -> (Move [size] dst src mem)
|
||||||
|
(Store [size] dst (Load src mem) (VarDef {x} mem)) && size > config.IntSize -> (Move [size] dst src (VarDef {x} mem))
|
||||||
|
|
||||||
(If (IsNonNil (GetG)) yes no) -> (First nil yes no)
|
(If (IsNonNil (GetG)) yes no) -> (First nil yes no)
|
||||||
|
|
||||||
|
@ -362,8 +362,8 @@ var genericOps = []opData{
|
|||||||
// Used during ssa construction. Like Copy, but the arg has not been specified yet.
|
// Used during ssa construction. Like Copy, but the arg has not been specified yet.
|
||||||
{name: "FwdRef"},
|
{name: "FwdRef"},
|
||||||
|
|
||||||
{name: "VarDef"}, // aux is a *gc.Node of a variable that is about to be initialized. arg0=mem, returns mem
|
{name: "VarDef", typ: "Mem"}, // aux is a *gc.Node of a variable that is about to be initialized. arg0=mem, returns mem
|
||||||
{name: "VarKill"}, // aux is a *gc.Node of a variable that is known to be dead. arg0=mem, returns mem
|
{name: "VarKill"}, // aux is a *gc.Node of a variable that is known to be dead. arg0=mem, returns mem
|
||||||
}
|
}
|
||||||
|
|
||||||
// kind control successors
|
// kind control successors
|
||||||
|
@ -1434,6 +1434,44 @@ func rewriteValuegeneric(v *Value, config *Config) bool {
|
|||||||
goto enda18a7163888e2f4fca9f38bae56cef42
|
goto enda18a7163888e2f4fca9f38bae56cef42
|
||||||
enda18a7163888e2f4fca9f38bae56cef42:
|
enda18a7163888e2f4fca9f38bae56cef42:
|
||||||
;
|
;
|
||||||
|
// match: (Store [size] dst (Load src mem) (VarDef {x} mem))
|
||||||
|
// cond: size > config.IntSize
|
||||||
|
// result: (Move [size] dst src (VarDef {x} mem))
|
||||||
|
{
|
||||||
|
size := v.AuxInt
|
||||||
|
dst := v.Args[0]
|
||||||
|
if v.Args[1].Op != OpLoad {
|
||||||
|
goto endc671c9b1be99e3125fe81e29018bc0e6
|
||||||
|
}
|
||||||
|
src := v.Args[1].Args[0]
|
||||||
|
mem := v.Args[1].Args[1]
|
||||||
|
if v.Args[2].Op != OpVarDef {
|
||||||
|
goto endc671c9b1be99e3125fe81e29018bc0e6
|
||||||
|
}
|
||||||
|
x := v.Args[2].Aux
|
||||||
|
if v.Args[2].Args[0] != mem {
|
||||||
|
goto endc671c9b1be99e3125fe81e29018bc0e6
|
||||||
|
}
|
||||||
|
if !(size > config.IntSize) {
|
||||||
|
goto endc671c9b1be99e3125fe81e29018bc0e6
|
||||||
|
}
|
||||||
|
v.Op = OpMove
|
||||||
|
v.AuxInt = 0
|
||||||
|
v.Aux = nil
|
||||||
|
v.resetArgs()
|
||||||
|
v.AuxInt = size
|
||||||
|
v.AddArg(dst)
|
||||||
|
v.AddArg(src)
|
||||||
|
v0 := b.NewValue0(v.Line, OpVarDef, TypeInvalid)
|
||||||
|
v0.Aux = x
|
||||||
|
v0.AddArg(mem)
|
||||||
|
v0.Type = TypeMem
|
||||||
|
v.AddArg(v0)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
goto endc671c9b1be99e3125fe81e29018bc0e6
|
||||||
|
endc671c9b1be99e3125fe81e29018bc0e6:
|
||||||
|
;
|
||||||
case OpStringLen:
|
case OpStringLen:
|
||||||
// match: (StringLen (StringMake _ len))
|
// match: (StringLen (StringMake _ len))
|
||||||
// cond:
|
// cond:
|
||||||
|
Loading…
Reference in New Issue
Block a user