[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>
This commit is contained in:
Keith Randall 2015-09-08 16:04:37 -07:00
parent 1c2975c305
commit a7cfc759f2
4 changed files with 18 additions and 8 deletions

View file

@ -369,9 +369,11 @@ var genericOps = []opData{
// 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.