mirror of
https://github.com/golang/go
synced 2024-11-11 18:01:47 -07:00
cmd/compile: handle min/max correctly in mayCall
CL 500575 changed mayCall to return "false" for min/max builtin. However, with string or float, min/max requires runtime call, so mayCall should return true instead. This's probably not a big problem, because CL 506115 makes order pass handle min/max correctly. But it's still better to do it the right way. Updates #60582 Change-Id: I9779ca62bebd0f95e52ad5fa55b9160dc35b33aa Reviewed-on: https://go-review.googlesource.com/c/go/+/506855 Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
79d4defa75
commit
8b5fe5980c
@ -337,10 +337,14 @@ func mayCall(n ir.Node) bool {
|
||||
n := n.(*ir.ConvExpr)
|
||||
return ssagen.Arch.SoftFloat && (isSoftFloat(n.Type()) || isSoftFloat(n.X.Type()))
|
||||
|
||||
case ir.OMIN, ir.OMAX:
|
||||
// string or float requires runtime call, see (*ssagen.state).minmax method.
|
||||
return n.Type().IsString() || n.Type().IsFloat()
|
||||
|
||||
case ir.OLITERAL, ir.ONIL, ir.ONAME, ir.OLINKSYMOFFSET, ir.OMETHEXPR,
|
||||
ir.OAND, ir.OANDNOT, ir.OLSH, ir.OOR, ir.ORSH, ir.OXOR, ir.OCOMPLEX, ir.OEFACE,
|
||||
ir.OADDR, ir.OBITNOT, ir.ONOT, ir.OPLUS,
|
||||
ir.OCAP, ir.OIMAG, ir.OLEN, ir.OREAL, ir.OMIN, ir.OMAX,
|
||||
ir.OCAP, ir.OIMAG, ir.OLEN, ir.OREAL,
|
||||
ir.OCONVNOP, ir.ODOT,
|
||||
ir.OCFUNC, ir.OIDATA, ir.OITAB, ir.OSPTR,
|
||||
ir.OBYTES2STRTMP, ir.OGETG, ir.OGETCALLERPC, ir.OGETCALLERSP, ir.OSLICEHEADER, ir.OSTRINGHEADER:
|
||||
|
Loading…
Reference in New Issue
Block a user