• philhofer's avatar
    cmd/compile: emit OffPtr for first field in SSA'd structs · a6bd42f2
    philhofer authored
    Given
    
      (Store [c] (OffPtr <T1> [0] (Addr <T> _)) _
        (Store [c] (Addr <T> _) _ _))
    
    dead store elimination doesn't eliminate the inner
    Store, because it addresses a type of a different width
    than the first store.
    
    When decomposing StructMake operations, always generate
    an OffPtr to address struct fields so that dead stores to
    the first field of the struct can be optimized away.
    
    benchmarks affected on darwin/amd64:
    HTTPClientServer-8        73.2µs ± 1%    72.7µs ± 1%  -0.69%  (p=0.022 n=9+10)
    TimeParse-8                304ns ± 1%     300ns ± 0%  -1.61%  (p=0.000 n=9+9)
    RegexpMatchEasy1_32-8     80.1ns ± 0%    79.5ns ± 1%  -0.84%  (p=0.000 n=8+9)
    GobDecode-8               6.78ms ± 0%    6.81ms ± 1%  +0.46%  (p=0.000 n=9+10)
    Gunzip-8                  36.1ms ± 1%    36.2ms ± 0%  +0.37%  (p=0.019 n=10+10)
    JSONEncode-8              15.6ms ± 0%    15.7ms ± 0%  +0.69%  (p=0.000 n=9+10)
    
    Change-Id: Ia80d73fd047f9400c616ca64fdee4f438a0e7f21
    Reviewed-on: https://go-review.googlesource.com/37769
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    a6bd42f2
generic.rules 73 KB