• Keith Randall's avatar
    [dev.ssa] cmd/compile: fix @ rewrite rules · ed737fd8
    Keith Randall authored
    The @ directive used to read the target block after some value
    structure had already changed.  I don't think it was ever really
    a bug, but it's confusing.
    
    It might fail like this:
    
    (Foo x y) -> @v.Args[0].Block (Bar y (Baz ...))
    
    v.Op = Bar
    v.Args[0] = y
    v.Args[1] = v.Args[0].Block.NewValue(Baz, ...)
    
    That new value is allocated in the block of y, not the
    block of x.
    
    Anyway, read the destination block first so this
    potential bug can't happen.
    
    Change-Id: Ie41d2fc349b35cefaa319fa9327808bcb781b4e2
    Reviewed-on: https://go-review.googlesource.com/19900
    Run-TryBot: Todd Neal <todd@tneal.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarTodd Neal <todd@tneal.org>
    ed737fd8
TODO 2.34 KB