1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:30:06 -07:00

cmd/compile: guard against invalid phis in shortcircuit

In the review of CL 222923, Keith expressed concern
that we could end up with invalid phis.

We have some code to handle this, but on further reflection,
I think it might not handle some cases in which phis get moved.

I can't create a failing case, but guard against it nevertheless.

Change-Id: Ib3a07ac1d36a674c72dcb9cc9261ccfcb716b5a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227697
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2020-03-11 14:49:37 -07:00
parent b78109e80e
commit 64dcef3045

View File

@ -237,7 +237,11 @@ func shortcircuitBlock(b *Block) bool {
}
}
}
phielimValue(phi)
if phi.Uses != 0 {
phielimValue(phi)
} else {
phi.reset(OpInvalid)
}
i-- // v.moveTo put a new value at index i; reprocess
}