]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: check indirect connection between if block and phi block in addLocalIndu...
authorCholerae Hu <choleraehyq@gmail.com>
Fri, 31 Jul 2020 05:57:48 +0000 (13:57 +0800)
committerDmitri Shuralyov <dmitshur@golang.org>
Sat, 7 Nov 2020 07:33:23 +0000 (07:33 +0000)
commita6755fc0debc3005e8bd730521ecc8dba61a24e8
tree53f1d1e0bbd42ea16ebed7851f0f4a72d3296eef
parentd51ae669363fdd4a741db7f0193e7e6ebc639ff3
cmd/compile: check indirect connection between if block and phi block in addLocalInductiveFacts

CL 244579 added guard clauses to prevent a faulty state that was
possible under the incorrect logic of the uniquePred loop in
addLocalInductiveFacts. That faulty state was still making the
intended optimization, but not for the correct reason.
Removing the faulty state also removed the overly permissive application
of the optimization, and therefore made these two tests fail.
We disabled the tests of this optimization in CL 244579 to allow us to
quickly apply the fix in the CL. This CL now corrects the logic of the
uniquePred loop in order to apply the optimization correctly.

The comment above the uniquePred loop says that it will follow unique
predecessors until it reaches a join point. Without updating the child
node on each iteration, it cannot follow the chain of unique
predecessors more than one step. Adding the update to the child node
on each iteration of the loop allows the logic to follow the chain of
unique predecessors until reaching a join point (because a non-unique
predecessor will signify a join point).

Updates #40502.

Change-Id: I23d8367046a2ab3ce4be969631f9ba15dc533e6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/246157
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
src/cmd/compile/internal/ssa/prove.go
test/prove.go