Change-Id: I4c9bcea01e2c4333c2a3592b66f1da9f424747a4
Reviewed-on: https://go-review.googlesource.com/12130
Reviewed-by: Keith Randall <khr@golang.org>
switch {
case t.IsString():
val = s.entryNewValue0A(ssa.OpConst, left.Type, "")
- case t.IsInteger():
+ case t.IsInteger() || t.IsPtr():
val = s.entryNewValue0(ssa.OpConst, left.Type)
case t.IsBoolean():
val = s.entryNewValue0A(ssa.OpConst, left.Type, false) // TODO: store bools as 0/1 in AuxInt?
(OffPtr [off] ptr) -> (ADDQconst [off] ptr)
(Const <t> [val]) && t.IsInteger() -> (MOVQconst [val])
+(Const <t>) && t.IsPtr() -> (MOVQconst [0]) // nil is the only const pointer
(Addr {sym} base) -> (LEAQ {sym} base)
goto end4c8bfe9df26fc5aa2bd76b211792732a
end4c8bfe9df26fc5aa2bd76b211792732a:
;
+ // match: (Const <t>)
+ // cond: t.IsPtr()
+ // result: (MOVQconst [0])
+ {
+ t := v.Type
+ if !(t.IsPtr()) {
+ goto endd23abe8d7061f11c260b162e24eec060
+ }
+ v.Op = OpAMD64MOVQconst
+ v.AuxInt = 0
+ v.Aux = nil
+ v.resetArgs()
+ v.AuxInt = 0
+ return true
+ }
+ goto endd23abe8d7061f11c260b162e24eec060
+ endd23abe8d7061f11c260b162e24eec060:
+ ;
case OpConvNop:
// match: (ConvNop <t> x)
// cond: t == x.Type