@@ -4374,31 +4374,28 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
4374
4374
4375
4375
switch n .Op {
4376
4376
case OCALLFUNC :
4377
+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4378
+ testLateExpansion = true
4379
+ }
4377
4380
if k == callNormal && fn .Op == ONAME && fn .Class () == PFUNC {
4378
4381
sym = fn .Sym
4379
- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4380
- testLateExpansion = true
4381
- }
4382
4382
break
4383
4383
}
4384
4384
closure = s .expr (fn )
4385
4385
if k != callDefer && k != callDeferStack {
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
- }
4392
4389
}
4393
4390
case OCALLMETH :
4394
4391
if fn .Op != ODOTMETH {
4395
4392
s .Fatalf ("OCALLMETH: n.Left not an ODOTMETH: %v" , fn )
4396
4393
}
4394
+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4395
+ testLateExpansion = true
4396
+ }
4397
4397
if k == callNormal {
4398
4398
sym = fn .Sym
4399
- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4400
- testLateExpansion = true
4401
- }
4402
4399
break
4403
4400
}
4404
4401
closure = s .getMethodClosure (fn )
@@ -4408,13 +4405,13 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
4408
4405
if fn .Op != ODOTINTER {
4409
4406
s .Fatalf ("OCALLINTER: n.Left not an ODOTINTER: %v" , fn .Op )
4410
4407
}
4408
+ if k != callDeferStack && ssa .LateCallExpansionEnabledWithin (s .f ) {
4409
+ testLateExpansion = true
4410
+ }
4411
4411
var iclosure * ssa.Value
4412
4412
iclosure , rcvr = s .getClosureAndRcvr (fn )
4413
4413
if k == callNormal {
4414
4414
codeptr = s .load (types .Types [TUINTPTR ], iclosure )
4415
- if ssa .LateCallExpansionEnabledWithin (s .f ) {
4416
- testLateExpansion = true
4417
- }
4418
4415
} else {
4419
4416
closure = iclosure
4420
4417
}
@@ -4549,9 +4546,21 @@ func (s *state) call(n *Node, k callKind, returnResultAddr bool) *ssa.Value {
4549
4546
// call target
4550
4547
switch {
4551
4548
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
+ }
4553
4556
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
+ }
4555
4564
case closure != nil :
4556
4565
// rawLoad because loading the code pointer from a
4557
4566
// closure is always safe, but IsSanitizerSafeAddr
0 commit comments