aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/block.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-09-16 13:50:18 -0700
committerKeith Randall <khr@golang.org>2016-09-19 16:00:13 +0000
commit75ce89c20dab10857ab0b5102001b34767c45b6e (patch)
treeb6d0086e53b0187137ca606d54e10d799d7f2761 /src/cmd/compile/internal/ssa/block.go
parent2679282da4e437ee086ec791ab73181c39ae3463 (diff)
downloadgo-75ce89c20dab10857ab0b5102001b34767c45b6e.tar.gz
go-75ce89c20dab10857ab0b5102001b34767c45b6e.zip
cmd/compile: cache CFG-dependent computations
We compute a lot of stuff based off the CFG: postorder traversal, dominators, dominator tree, loop nest. Multiple phases use this information and we end up recomputing some of it. Add a cache for this information so if the CFG hasn't changed, we can reuse the previous computation. Change-Id: I9b5b58af06830bd120afbee9cfab395a0a2f74b2 Reviewed-on: https://go-review.googlesource.com/29356 Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/block.go')
-rw-r--r--src/cmd/compile/internal/ssa/block.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/block.go b/src/cmd/compile/internal/ssa/block.go
index 49c1304057..b5bedd3912 100644
--- a/src/cmd/compile/internal/ssa/block.go
+++ b/src/cmd/compile/internal/ssa/block.go
@@ -144,6 +144,7 @@ func (b *Block) AddEdgeTo(c *Block) {
j := len(c.Preds)
b.Succs = append(b.Succs, Edge{c, j})
c.Preds = append(c.Preds, Edge{b, i})
+ b.Func.invalidateCFG()
}
// removePred removes the ith input edge from b.
@@ -159,6 +160,7 @@ func (b *Block) removePred(i int) {
}
b.Preds[n] = Edge{}
b.Preds = b.Preds[:n]
+ b.Func.invalidateCFG()
}
// removeSucc removes the ith output edge from b.
@@ -174,6 +176,7 @@ func (b *Block) removeSucc(i int) {
}
b.Succs[n] = Edge{}
b.Succs = b.Succs[:n]
+ b.Func.invalidateCFG()
}
func (b *Block) swapSuccessors() {