Commit 4c162208 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: default avatarKeith Randall <khr@golang.org>
parent fc327a14
...@@ -16,17 +16,6 @@ import ( ...@@ -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) { ...@@ -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) { ...@@ -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 {
......
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