@@ -4374,31 +4374,28 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
43744374
43754375 switch n .Op {
43764376 case OCALLFUNC :
4377+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4378+ testLateExpansion = true
4379+ }
43774380 if k == callNormal && fn .Op == ONAME && fn .Class () == PFUNC {
43784381 sym = fn .Sym
4379- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4380- testLateExpansion = true
4381- }
43824382 break
43834383 }
43844384 closure = s .expr (fn )
43854385 if k != callDefer && k != callDeferStack {
43864386 // Deferred nil function needs to panic when the function is invoked,
43874387 // not the point of defer statement.
43884388 s .maybeNilCheckClosure (closure , k )
4389- if k == callNormal && ssa .LateCallExpansionEnabledWithin (s .f ) {
4390- testLateExpansion = true
4391- }
43924389 }
43934390 case OCALLMETH :
43944391 if fn .Op != ODOTMETH {
43954392 s .Fatalf ("OCALLMETH: n.Left not an ODOTMETH: %v" , fn )
43964393 }
4394+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4395+ testLateExpansion = true
4396+ }
43974397 if k == callNormal {
43984398 sym = fn .Sym
4399- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4400- testLateExpansion = true
4401- }
44024399 break
44034400 }
44044401 closure = s .getMethodClosure (fn )
@@ -4408,13 +4405,13 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
44084405 if fn .Op != ODOTINTER {
44094406 s .Fatalf ("OCALLINTER: n.Left not an ODOTINTER: %v" , fn .Op )
44104407 }
4408+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4409+ testLateExpansion = true
4410+ }
44114411 var iclosure * ssa.Value
44124412 iclosure , rcvr = s .getClosureAndRcvr (fn )
44134413 if k == callNormal {
44144414 codeptr = s .load (types .Types [TUINTPTR ], iclosure )
4415- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4416- testLateExpansion = true
4417- }
44184415 } else {
44194416 closure = iclosure
44204417 }
@@ -4549,9 +4546,21 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
45494546 // call target
45504547 switch {
45514548 case k == callDefer :
4552- call = s .newValue1A (ssa .OpStaticCall , types .TypeMem , ssa .StaticAuxCall (deferproc , ACArgs , ACResults ), s .mem ())
4549+ aux := ssa .StaticAuxCall (deferproc , ACArgs , ACResults )
4550+ if testLateExpansion {
4551+ call = s .newValue0A (ssa .OpStaticLECall , aux .LateExpansionResultType (), aux )
4552+ call .AddArgs (callArgs ... )
4553+ } else {
4554+ call = s .newValue1A (ssa .OpStaticCall , types .TypeMem , aux , s .mem ())
4555+ }
45534556 case k == callGo :
4554- call = s .newValue1A (ssa .OpStaticCall , types .TypeMem , ssa .StaticAuxCall (newproc , ACArgs , ACResults ), s .mem ())
4557+ aux := ssa .StaticAuxCall (newproc , ACArgs , ACResults )
4558+ if testLateExpansion {
4559+ call = s .newValue0A (ssa .OpStaticLECall , aux .LateExpansionResultType (), aux )
4560+ call .AddArgs (callArgs ... )
4561+ } else {
4562+ call = s .newValue1A (ssa .OpStaticCall , types .TypeMem , aux , s .mem ())
4563+ }
45554564 case closure != nil :
45564565 // rawLoad because loading the code pointer from a
45574566 // closure is always safe, but IsSanitizerSafeAddr
0 commit comments