mirror of
https://github.com/golang/go
synced 2024-11-18 04:34:52 -07:00
cmd/compile: don't catch panics during rewrite
This is a holdover from the days when we did not have full SSA coverage and compiled things optimistically, and catching the panic obscures useful information. Change-Id: I196790cb6b97419d92b318a2dfa7f1e1097cefb7 Reviewed-on: https://go-review.googlesource.com/39534 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
fc327a14c4
commit
4c1622082e
@ -16,17 +16,6 @@ import (
|
|||||||
|
|
||||||
func applyRewrite(f *Func, rb blockRewriter, rv valueRewriter) {
|
func applyRewrite(f *Func, rb blockRewriter, rv valueRewriter) {
|
||||||
// repeat rewrites until we find no more rewrites
|
// repeat rewrites until we find no more rewrites
|
||||||
var curb *Block
|
|
||||||
var curv *Value
|
|
||||||
defer func() {
|
|
||||||
if curb != nil {
|
|
||||||
curb.Fatalf("panic during rewrite of block %s\n", curb.LongString())
|
|
||||||
}
|
|
||||||
if curv != nil {
|
|
||||||
curv.Fatalf("panic during rewrite of value %s\n", curv.LongString())
|
|
||||||
// TODO(khr): print source location also
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
for {
|
for {
|
||||||
change := false
|
change := false
|
||||||
for _, b := range f.Blocks {
|
for _, b := range f.Blocks {
|
||||||
@ -35,11 +24,9 @@ func applyRewrite(f *Func, rb blockRewriter, rv valueRewriter) {
|
|||||||
b.SetControl(b.Control.Args[0])
|
b.SetControl(b.Control.Args[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
curb = b
|
|
||||||
if rb(b) {
|
if rb(b) {
|
||||||
change = true
|
change = true
|
||||||
}
|
}
|
||||||
curb = nil
|
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
change = phielimValue(v) || change
|
change = phielimValue(v) || change
|
||||||
|
|
||||||
@ -64,11 +51,9 @@ func applyRewrite(f *Func, rb blockRewriter, rv valueRewriter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply rewrite function
|
// apply rewrite function
|
||||||
curv = v
|
|
||||||
if rv(v) {
|
if rv(v) {
|
||||||
change = true
|
change = true
|
||||||
}
|
}
|
||||||
curv = nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !change {
|
if !change {
|
||||||
|
Loading…
Reference in New Issue
Block a user