[dev.ssa] cmd/compile: panic doesn't return

Panic doesn't return, so record that we immediately exit after a panic
call.  This will help code analysis.

Change-Id: I4d1f67494f97b6aee130c43ff4e44307b2b0f149
Reviewed-on: https://go-review.googlesource.com/19303
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 71d5920..b7019d6 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -544,6 +544,15 @@
 	// Expression statements
 	case OCALLFUNC, OCALLMETH, OCALLINTER:
 		s.call(n, callNormal)
+		if n.Op == OCALLFUNC && n.Left.Op == ONAME && n.Left.Class == PFUNC && n.Left.Sym.Pkg == Runtimepkg && n.Left.Sym.Name == "gopanic" {
+			m := s.mem()
+			b := s.endBlock()
+			b.Kind = ssa.BlockExit
+			b.Control = m
+			// TODO: never rewrite OPANIC to OCALLFUNC in the
+			// first place.  Need to wait until all backends
+			// go through SSA.
+		}
 	case ODEFER:
 		s.call(n.Left, callDefer)
 	case OPROC: