• David Chase's avatar
    cmd/compile: preserve statement mark in rematerialized values · c8e7c53b
    David Chase authored
    Statement markers on rematerializable values were getting lost in
    register allocation.  This checks for that case (rematerializable
    input and using value share line number, but mark is on the input)
    and preserves the mark.
    
    When combined with other CLs in this series, this CL reduces the
    "nostmt" count (a line appears in the assembly, but no statement
    marker) for cmd/go from 413 to 277.  The rematerialized input is
    usually a LEAQ (on AMD64).
    
    The cause is "complicated"; for example, a NilCheck originally has the
    statement mark (a good thing, if the NilCheck  remains) but the
    NilCheck is removed and the mark floats to a Block end, then to a
    SliceMake.  The SliceMake decomposes and goes dead without preserving
    its marker (its component values are elided in other rewrites and may
    target inputs with different line numbers), but before deadcode
    removes it from the graph it moves the mark to an input, which at that
    time happens to be a LocalAddr. This eventually transforms to a LEAQ.
    
    Change-Id: Iff91fc2a934357fb59ec46ac87b4a9b1057d9160
    Reviewed-on: https://go-review.googlesource.com/c/go/+/198480
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarJeremy Faller <jeremy@golang.org>
    c8e7c53b
value.go 10.7 KB