mirror of
https://github.com/golang/go
synced 2024-11-24 18:20:02 -07:00
[dev.ssa] cmd/compile: leave JMPs in when using -N
Helps keep line numbers around for debugging, particularly for break and continue statements (which often compile down to nothing). Update #14379 Change-Id: I6ea06aa887b0450d9ba4f11e319e5c263f5a98ba Reviewed-on: https://go-review.googlesource.com/19848 Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
d337e55672
commit
8906d2a171
@ -3627,7 +3627,10 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
|
|||||||
}
|
}
|
||||||
// Emit control flow instructions for block
|
// Emit control flow instructions for block
|
||||||
var next *ssa.Block
|
var next *ssa.Block
|
||||||
if i < len(f.Blocks)-1 {
|
if i < len(f.Blocks)-1 && Debug['N'] == 0 {
|
||||||
|
// If -N, leave next==nil so every block with successors
|
||||||
|
// ends in a JMP. Helps keep line numbers for otherwise
|
||||||
|
// empty blocks.
|
||||||
next = f.Blocks[i+1]
|
next = f.Blocks[i+1]
|
||||||
}
|
}
|
||||||
x := Pc
|
x := Pc
|
||||||
|
@ -21,6 +21,7 @@ func critical(f *Func) {
|
|||||||
|
|
||||||
// allocate a new block to place on the edge
|
// allocate a new block to place on the edge
|
||||||
d := f.NewBlock(BlockPlain)
|
d := f.NewBlock(BlockPlain)
|
||||||
|
d.Line = c.Line
|
||||||
|
|
||||||
// splice it in
|
// splice it in
|
||||||
d.Preds = append(d.Preds, c)
|
d.Preds = append(d.Preds, c)
|
||||||
|
Loading…
Reference in New Issue
Block a user