]> Cypherpunks repositories - gostls13.git/commit
[dev.ssa] cmd/compile/internal/ssa: add arg-dominating check, fix phielim
authorKeith Randall <khr@golang.org>
Fri, 28 Aug 2015 19:53:41 +0000 (12:53 -0700)
committerKeith Randall <khr@golang.org>
Fri, 28 Aug 2015 20:40:06 +0000 (20:40 +0000)
commitf8093b8f2491171c996c4820fe7b9a2796ac1084
tree93adbc5dda7e761d76afcdcc157501892b1cc7f9
parent525785885e42b26e6936e5d91386518218cff4d7
[dev.ssa] cmd/compile/internal/ssa: add arg-dominating check, fix phielim

Add a check to make sure value arguments dominate the value.

Phi elim output used to fail this test.  When eliminating
redundant phis, phi elim was using one of the args and not
the ultimate source.  For example:

          b1: x = ...
          -> b2 b3

b2: y = Copy x        b3: z = Copy x
-> b4                 -> b4

          b4: w = phi y z

Phi elim eliminates w, but it used to replace w with (Copy y).
That's bad as b2 does not dominate b4.  Instead we should
replace w with (Copy x).

Fixes #12347

Change-Id: I9f340cdabcda8e2e90359fb4f9250877b1fffe98
Reviewed-on: https://go-review.googlesource.com/13986
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/check.go
src/cmd/compile/internal/ssa/phielim.go