Commit 9a926911 authored by David Chase's avatar David Chase

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: default avatarJeremy Faller <jeremy@golang.org>
parent 7e4d87b7
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment