]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile: fix @ rewrite rules
authorKeith Randall <khr@golang.org>
Wed, 24 Feb 2016 18:29:27 +0000 (10:29 -0800)
committerKeith Randall <khr@golang.org>
Wed, 24 Feb 2016 22:20:24 +0000 (22:20 +0000)
commited737fd8cdc1a668027bb5f5dac8879afabcca3b
tree676bd1b45e6b36cccf052936f5e9f3d57c9dfcaf
parente173ab14345b1f205a8f14e25a81184752a9d43b
[dev.ssa] cmd/compile: fix @ rewrite rules

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: Todd Neal <todd@tneal.org>
src/cmd/compile/internal/ssa/TODO
src/cmd/compile/internal/ssa/gen/rulegen.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewritegeneric.go