]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid infinite loops in dead blocks during phi insertion
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 13:45:36 +0000 (06:45 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 17:06:08 +0000 (17:06 +0000)
commit5272a2cdc551c041a9f744ede72506be5f622196
treec050340c0d196de857915e39909acb92e3c2aa71
parent3431d9113c7e01a0ddb458a075ca571d3873e061
cmd/compile: avoid infinite loops in dead blocks during phi insertion

Now that we no longer generate dead code,
it is possible to follow block predecessors
into infinite loops with no variable definitions,
causing an infinite loop during phi insertion.

To fix that, check explicitly whether the predecessor
is dead in lookupVarOutgoing, and if so, bail.

The loop in lookupVarOutgoing is very hot code,
so I am wary of adding anything to it.
However, a long, CPU-only benchmarking run shows no
performance impact at all.

Fixes #19783

Change-Id: I8ef8d267e0b20a29b5cb0fecd7084f76c6f98e47
Reviewed-on: https://go-review.googlesource.com/38913
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/phi.go
test/fixedbugs/issue19783.go [new file with mode: 0644]