@@ -4386,6 +4386,9 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
4386
4386
// Deferred nil function needs to panic when the function is invoked,
4387
4387
// not the point of defer statement.
4388
4388
s .maybeNilCheckClosure (closure , k )
4389
+ if k == callNormal && ssa .LateCallExpansionEnabledWithin (s .f ) {
4390
+ testLateExpansion = true
4391
+ }
4389
4392
}
4390
4393
case OCALLMETH :
4391
4394
if fn .Op != ODOTMETH {
@@ -4556,7 +4559,13 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
4556
4559
// critical that we not clobber any arguments already
4557
4560
// stored onto the stack.
4558
4561
codeptr = s .rawLoad (types .Types [TUINTPTR ], closure )
4559
- call = s .newValue3A (ssa .OpClosureCall , types .TypeMem , ssa .ClosureAuxCall (ACArgs , ACResults ), codeptr , closure , s .mem ())
4562
+ if testLateExpansion {
4563
+ aux := ssa .ClosureAuxCall (ACArgs , ACResults )
4564
+ call = s .newValue2A (ssa .OpClosureLECall , aux .LateExpansionResultType (), aux , codeptr , closure )
4565
+ call .AddArgs (callArgs ... )
4566
+ } else {
4567
+ call = s .newValue3A (ssa .OpClosureCall , types .TypeMem , ssa .ClosureAuxCall (ACArgs , ACResults ), codeptr , closure , s .mem ())
4568
+ }
4560
4569
case codeptr != nil :
4561
4570
if testLateExpansion {
4562
4571
aux := ssa .InterfaceAuxCall (ACArgs , ACResults )
0 commit comments