// we know the underlying type is pointer-ish.
(StaticLECall {f} typ_ x y mem)
&& isSameCall(f, "runtime.efaceeq")
- && isDirectType(typ_)
+ && isDirectAndComparableType(typ_)
&& clobber(v)
=> (MakeResult (EqPtr x y) mem)
// we know the underlying type is pointer-ish.
(StaticLECall {f} itab x y mem)
&& isSameCall(f, "runtime.ifaceeq")
- && isDirectIface(itab)
+ && isDirectAndComparableIface(itab)
&& clobber(v)
=> (MakeResult (EqPtr x y) mem)
return mem
}
-// isDirectType reports whether v represents a type
+// isDirectAndComparableType reports whether v represents a type
// (a *runtime._type) whose value is stored directly in an
// interface (i.e., is pointer or pointer-like) and is comparable.
-func isDirectType(v *Value) bool {
- return isDirectType1(v)
+func isDirectAndComparableType(v *Value) bool {
+ return isDirectAndComparableType1(v)
}
// v is a type
-func isDirectType1(v *Value) bool {
+func isDirectAndComparableType1(v *Value) bool {
switch v.Op {
case OpITab:
- return isDirectType2(v.Args[0])
+ return isDirectAndComparableType2(v.Args[0])
case OpAddr:
lsym := v.Aux.(*obj.LSym)
if ti := lsym.TypeInfo(); ti != nil {
}
// v is an empty interface
-func isDirectType2(v *Value) bool {
+func isDirectAndComparableType2(v *Value) bool {
switch v.Op {
case OpIMake:
- return isDirectType1(v.Args[0])
+ return isDirectAndComparableType1(v.Args[0])
}
return false
}
-// isDirectIface reports whether v represents an itab
+// isDirectAndComparableIface reports whether v represents an itab
// (a *runtime._itab) for a type whose value is stored directly
// in an interface (i.e., is pointer or pointer-like) and is comparable.
-func isDirectIface(v *Value) bool {
- return isDirectIface1(v, 9)
+func isDirectAndComparableIface(v *Value) bool {
+ return isDirectAndComparableIface1(v, 9)
}
// v is an itab
-func isDirectIface1(v *Value, depth int) bool {
+func isDirectAndComparableIface1(v *Value, depth int) bool {
if depth == 0 {
return false
}
switch v.Op {
case OpITab:
- return isDirectIface2(v.Args[0], depth-1)
+ return isDirectAndComparableIface2(v.Args[0], depth-1)
case OpAddr:
lsym := v.Aux.(*obj.LSym)
if ii := lsym.ItabInfo(); ii != nil {
}
// v is an interface
-func isDirectIface2(v *Value, depth int) bool {
+func isDirectAndComparableIface2(v *Value, depth int) bool {
if depth == 0 {
return false
}
switch v.Op {
case OpIMake:
- return isDirectIface1(v.Args[0], depth-1)
+ return isDirectAndComparableIface1(v.Args[0], depth-1)
case OpPhi:
for _, a := range v.Args {
- if !isDirectIface2(a, depth-1) {
+ if !isDirectAndComparableIface2(a, depth-1) {
return false
}
}
return true
}
// match: (StaticLECall {f} typ_ x y mem)
- // cond: isSameCall(f, "runtime.efaceeq") && isDirectType(typ_) && clobber(v)
+ // cond: isSameCall(f, "runtime.efaceeq") && isDirectAndComparableType(typ_) && clobber(v)
// result: (MakeResult (EqPtr x y) mem)
for {
if len(v.Args) != 4 {
typ_ := v.Args[0]
x := v.Args[1]
y := v.Args[2]
- if !(isSameCall(f, "runtime.efaceeq") && isDirectType(typ_) && clobber(v)) {
+ if !(isSameCall(f, "runtime.efaceeq") && isDirectAndComparableType(typ_) && clobber(v)) {
break
}
v.reset(OpMakeResult)
return true
}
// match: (StaticLECall {f} itab x y mem)
- // cond: isSameCall(f, "runtime.ifaceeq") && isDirectIface(itab) && clobber(v)
+ // cond: isSameCall(f, "runtime.ifaceeq") && isDirectAndComparableIface(itab) && clobber(v)
// result: (MakeResult (EqPtr x y) mem)
for {
if len(v.Args) != 4 {
itab := v.Args[0]
x := v.Args[1]
y := v.Args[2]
- if !(isSameCall(f, "runtime.ifaceeq") && isDirectIface(itab) && clobber(v)) {
+ if !(isSameCall(f, "runtime.ifaceeq") && isDirectAndComparableIface(itab) && clobber(v)) {
break
}
v.reset(OpMakeResult)