aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/value.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ssa/value.go')
-rw-r--r--src/cmd/compile/internal/ssa/value.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index 630e4814b9..630143cc50 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -351,11 +351,13 @@ func (v *Value) reset(op Op) {
// invalidateRecursively marks a value as invalid (unused)
// and after decrementing reference counts on its Args,
// also recursively invalidates any of those whose use
-// count goes to zero.
+// count goes to zero. It returns whether any of the
+// invalidated values was marked with IsStmt.
//
// BEWARE of doing this *before* you've applied intended
// updates to SSA.
-func (v *Value) invalidateRecursively() {
+func (v *Value) invalidateRecursively() bool {
+ lostStmt := v.Pos.IsStmt() == src.PosIsStmt
if v.InCache {
v.Block.Func.unCache(v)
}
@@ -364,7 +366,8 @@ func (v *Value) invalidateRecursively() {
for _, a := range v.Args {
a.Uses--
if a.Uses == 0 {
- a.invalidateRecursively()
+ lost := a.invalidateRecursively()
+ lostStmt = lost || lostStmt
}
}
@@ -375,6 +378,7 @@ func (v *Value) invalidateRecursively() {
v.AuxInt = 0
v.Aux = nil
+ return lostStmt
}
// copyOf is called from rewrite rules.