From: Matthew Dempsky Date: Wed, 3 Oct 2018 22:47:16 +0000 (-0700) Subject: cmd/compile: handle TPTR32 like TPTR64 in smallintconst X-Git-Tag: go1.12beta1~899 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d397d4bffc0fa917fa53970ded4b4d3524f88a5b;p=gostls13.git cmd/compile: handle TPTR32 like TPTR64 in smallintconst In preparation for followup CL merging TPTR32 and TPTR64, move TPTR32 from the small-types fast path to the generic 64-bit fallback code so that it's in the same case clause as TPTR64. This should be safe, but theoretically it could change semantics because TPTR32 used to always be assumed to be "small", whereas now it will only be considered small for values less than 1<<31. This change is done in a separate CL so that it's more easily identified by git bisection in case it does introduce regressions. Change-Id: I6c7bb253d4e4d95c530a6e05a1147905674b55ca Reviewed-on: https://go-review.googlesource.com/c/139517 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/gc/const.go b/src/cmd/compile/internal/gc/const.go index 02d51678be..a80455a30c 100644 --- a/src/cmd/compile/internal/gc/const.go +++ b/src/cmd/compile/internal/gc/const.go @@ -1479,11 +1479,10 @@ func smallintconst(n *Node) bool { TUINT16, TINT32, TUINT32, - TBOOL, - TPTR32: + TBOOL: return true - case TIDEAL, TINT64, TUINT64, TPTR64: + case TIDEAL, TINT64, TUINT64, TPTR32, TPTR64: v, ok := n.Val().U.(*Mpint) if ok && v.Cmp(minintval[TINT32]) > 0 && v.Cmp(maxintval[TINT32]) < 0 { return true