[dev.ssa] cmd/compile/internal/ssa: handle returns correctly
Make sure that return blocks take a store as their control. Without
this, code was getting inserted between the return and exit blocks.
Use AEND to mark the end of code. The live variable analysis gets
confused when routines end like:
JMP earlier
RET
because the RET is unreachable. The RET was incorrectly added to the
last basic block, rendering the JMP invisible to the CFG builder.
Change-Id: I91b32c8b37075347243ff039b4e4385856fba7cd
Reviewed-on: https://go-review.googlesource.com/14398
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
diff --git a/src/cmd/compile/internal/ssa/gen/genericOps.go b/src/cmd/compile/internal/ssa/gen/genericOps.go
index 042d34e..9bc7790 100644
--- a/src/cmd/compile/internal/ssa/gen/genericOps.go
+++ b/src/cmd/compile/internal/ssa/gen/genericOps.go
@@ -369,9 +369,11 @@
// kind control successors
// ------------------------------------------
// Exit return mem []
+// Ret return mem [exit]
// Plain nil [next]
// If a boolean Value [then, else]
-// Call mem [nopanic, panic] (control opcode should be OpCall or OpStaticCall)
+// Call mem [nopanic, exit] (control opcode should be OpCall or OpStaticCall)
+// First nil [always,never]
var genericBlocks = []blockData{
{name: "Exit"}, // no successors. There should only be 1 of these.