]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: preserve full inlined location for ir.Name locals
authorDavid Chase <drchase@google.com>
Tue, 31 Jan 2023 04:54:13 +0000 (23:54 -0500)
committerDavid Chase <drchase@google.com>
Tue, 28 Feb 2023 19:08:09 +0000 (19:08 +0000)
This was noticed while testing hash-search debugging
of the loopvar experiment.

The change is incomplete -- it only addresses local
variables, not parameters.  The code to log/search
changes in loop variable semantics depends on this,
so that will be the test.

Change-Id: I0f84ab7696c6cab43486242cacaba6a0bfc45475
Reviewed-on: https://go-review.googlesource.com/c/go/+/464315
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>

src/cmd/compile/internal/noder/reader.go

index d2d9d5a5505b67bee1a907a5cd692d1c29ff08aa..7a8350b1fb9b97a9d33c660ee633f72fce5816df 100644 (file)
@@ -1566,13 +1566,6 @@ func (r *reader) addLocal(name *ir.Name, ctxt ir.Class) {
                        name.SetInlFormal(true)
                        ctxt = ir.PAUTO
                }
-
-               // TODO(mdempsky): Rethink this hack.
-               if strings.HasPrefix(name.Sym().Name, "~") || base.Flag.GenDwarfInl == 0 {
-                       name.SetPos(r.inlCall.Pos())
-                       name.SetInlFormal(false)
-                       name.SetInlLocal(false)
-               }
        }
 
        name.Class = ctxt
@@ -3549,15 +3542,9 @@ func unifiedInlineCall(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.Inlined
                        name.Curfn = callerfn
                        callerfn.Dcl = append(callerfn.Dcl, name)
 
-                       // Quirkish. TODO(mdempsky): Document why.
                        if name.AutoTemp() {
                                name.SetEsc(ir.EscUnknown)
-
-                               if base.Flag.GenDwarfInl != 0 {
-                                       name.SetInlLocal(true)
-                               } else {
-                                       name.SetPos(r.inlCall.Pos())
-                               }
+                               name.SetInlLocal(true)
                        }
                }
        }