• David Chase's avatar
    cmd/compile: fix subword store/load elision for amd64, x86, arm · 9613a638
    David Chase authored
    Replacing byteload-of-bytestore-of-x with x is incorrect
    when x contains a larger-than-byte value (and so on for
    16 and 32-bit load/store pairs).  Replace "x" with the
    appropriate zero/sign extension of x, which if unnecessary
    will be repaired by other rules.
    
    Made logic for arm match x86 and amd64; yields minor extra
    optimization, plus I am (much) more confident it's correct,
    despite inability to reproduce bug on arm.
    
    Ppc64 lacks this optimization, hence lacks this problem.
    
    See related https://golang.org/cl/37154/
    Fixes #20530.
    
    Change-Id: I6af9cac2ad43bee99cafdcb04725ce7e55a43323
    Reviewed-on: https://go-review.googlesource.com/44355
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    9613a638
rewrite386.go 396 KB