go /
tools /
6d30ceaab7ab5caffba4974a61e36d34268756ec go/ssa: fix regression in φ-elimination
https://go-review.googlesource.com/37157 introduced a bug that caused
some live φ-nodes to be removed from the CFG. The cause was that
reachability traversal considered edges only among "new" φ-nodes
(those introduced during SSA renaming) but not existing φ-nodes from
&& and || expressions. The fix is to mark existing phis, and thus
other phis reachable from them, as live. We also clear the Phi.block
field when eliminating a φ-node.
Also, during reachability, we treat DebugRef instructions as roots
like any other non-Phi instruction. This eliminates a related known
bug whereby the operand of a DebugRef may be a dead φ.
This change also adds a sanity check that all operands of an SSA value
that are themselves instructions must belong to a block. The sanity
check would fail 7 times on the standard library without the fix.
Fixes golang/go#19622
Change-Id: If3a897a6a593a17bc3f0f8228d1edf483be7a3d0
Reviewed-on: https://go-review.googlesource.com/45832
Run-TryBot: Dominik Honnef <dominik@honnef.co>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
3 files changed