]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: adjust line numbering for type switch
authorDavid Chase <drchase@google.com>
Thu, 3 Oct 2019 17:44:33 +0000 (13:44 -0400)
committerDavid Chase <drchase@google.com>
Fri, 4 Oct 2019 21:09:33 +0000 (21:09 +0000)
Two changes, one to cause the back end to not number ITab operations
(these tend to disappear and are also followed by something more robust)
and to explicitly unmark (as statements) all but the first bit of
the code generated to implement a type switch.

Change-Id: I9f7bf7cbf7ccc5d7eda57f7fb080e600eb312eb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/198739
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/compile/internal/gc/swt.go
src/cmd/compile/internal/ssa/numberlines.go

index 1381cdacba930e0853e5d6b86ce31a80b3f138b3..2098228d752cc4e66da8a4cab6914931d5f18d67 100644 (file)
@@ -513,6 +513,7 @@ func walkTypeSwitch(sw *Node) {
        // Use a similar strategy for non-empty interfaces.
        ifNil := nod(OIF, nil, nil)
        ifNil.Left = nod(OEQ, itab, nodnil())
+       lineno = lineno.WithNotStmt() // disable statement marks after the first check.
        ifNil.Left = typecheck(ifNil.Left, ctxExpr)
        ifNil.Left = defaultlit(ifNil.Left, nil)
        // ifNil.Nbody assigned at end.
index 68195e9b656b1d22bf5cba257ac366524b4a1f44..6321d615372839d88ce72f5b8d097ed1cee0cd58 100644 (file)
@@ -15,7 +15,7 @@ func isPoorStatementOp(op Op) bool {
        switch op {
        // Note that Nilcheck often vanishes, but when it doesn't, you'd love to start the statement there
        // so that a debugger-user sees the stop before the panic, and can examine the value.
-       case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi,
+       case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, OpITab, OpIData,
                OpIMake, OpStringMake, OpSliceMake, OpStructMake0, OpStructMake1, OpStructMake2, OpStructMake3, OpStructMake4,
                OpConstBool, OpConst8, OpConst16, OpConst32, OpConst64, OpConst32F, OpConst64F:
                return true