mirror of https://github.com/golang/go.git
cmd/compile/internal/inline/inlheur: remove ConstExpr assumption
OLITERAL isn't always ConstExpr. It can also be BasicLit or Name. Change-Id: I44d595830f9e206eccf6fb37bd47ddf957db0866 Reviewed-on: https://go-review.googlesource.com/c/go/+/526277 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
ae09ca6c0f
commit
0725410df5
|
|
@ -222,14 +222,13 @@ func isAllocatedMem(n ir.Node) bool {
|
|||
|
||||
func isLiteral(n ir.Node) (constant.Value, bool) {
|
||||
sv := ir.StaticValue(n)
|
||||
if sv.Op() == ir.ONIL {
|
||||
switch sv.Op() {
|
||||
case ir.ONIL:
|
||||
return nil, true
|
||||
case ir.OLITERAL:
|
||||
return sv.Val(), true
|
||||
}
|
||||
if sv.Op() != ir.OLITERAL {
|
||||
return nil, false
|
||||
}
|
||||
ce := sv.(*ir.ConstExpr)
|
||||
return ce.Val(), true
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// isSameLiteral checks to see if 'v1' and 'v2' correspond to the same
|
||||
|
|
|
|||
Loading…
Reference in New Issue