]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: tighten the condition for inlining shape/non-shape function
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 15 May 2022 01:05:41 +0000 (08:05 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 17 May 2022 00:58:22 +0000 (00:58 +0000)
commitf2b1cde544d190e1f4642ef6f4ac8ef9ce31a0c3
treed234955736bbadd48fda7435d9610604a8438979
parentb79c135f377e2cbae888ef50b83f1ee5025af906
cmd/compile: tighten the condition for inlining shape/non-shape function

CL 395854 made inline pass to not inlining function with shape params,
but pass no shape arguments. This is intended to be the reverse case of
CL 361260.

However, CL 361260 is using wider condition than necessary. Though it
only needs to check against function parameters, it checks whether the
function type has no shape. It does not cause any issue, because
!fn.Type().HasShape() implies !fn.Type().Params().HasShape().

But for the reverse case, it's not true. Function may have shape type,
but has no shape arguments. Thus, we must tighten the condition to
explicitly check against the function parameters only.

Fixes #52907

Change-Id: Ib87e87ff767c31d99d5b36aa4a6c1d8baf32746d
Reviewed-on: https://go-review.googlesource.com/c/go/+/406475
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/inline/inl.go
test/fixedbugs/issue52907.go