mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: attempt to preserve statements when prove removes code
This was a cause of some statements being lost. Change-Id: I81c95dcf3df6ed8a03b7578a27f9b21d33b3cf39 Reviewed-on: https://go-review.googlesource.com/c/go/+/198484 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
7e4d87b770
commit
9a926911fe
1 changed files with 6 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
package ssa
|
||||
|
||||
import (
|
||||
"cmd/internal/src"
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
|
@ -1284,18 +1285,22 @@ func simplifyBlock(sdom SparseTree, ft *factsTable, b *Block) {
|
|||
}
|
||||
|
||||
func removeBranch(b *Block, branch branch) {
|
||||
c := b.Controls[0]
|
||||
if b.Func.pass.debug > 0 {
|
||||
verb := "Proved"
|
||||
if branch == positive {
|
||||
verb = "Disproved"
|
||||
}
|
||||
c := b.Controls[0]
|
||||
if b.Func.pass.debug > 1 {
|
||||
b.Func.Warnl(b.Pos, "%s %s (%s)", verb, c.Op, c)
|
||||
} else {
|
||||
b.Func.Warnl(b.Pos, "%s %s", verb, c.Op)
|
||||
}
|
||||
}
|
||||
if c != nil && c.Pos.IsStmt() == src.PosIsStmt && c.Pos.SameFileAndLine(b.Pos) {
|
||||
// attempt to preserve statement marker.
|
||||
b.Pos = b.Pos.WithIsStmt()
|
||||
}
|
||||
b.Kind = BlockFirst
|
||||
b.ResetControls()
|
||||
if branch == positive {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue