aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/func.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2020-08-08 07:58:04 -0700
committerKeith Randall <khr@golang.org>2020-08-14 21:49:36 +0000
commit32a84c99e136ed5af0686dbedd31fd7dff40fb38 (patch)
treea9848570e095da03bf0f85f2a509a722cb186e54 /src/cmd/compile/internal/ssa/func.go
parent02a7b4b4a70d0574f82776309feaf28f109f5399 (diff)
downloadgo-32a84c99e136ed5af0686dbedd31fd7dff40fb38.tar.gz
go-32a84c99e136ed5af0686dbedd31fd7dff40fb38.zip
cmd/compile: fix live variable computation for deferreturn
Taking the live variable set from the last return point is problematic. See #40629 for details, but there may not be a return point, or it may be before the final defer. Additionally, keeping track of the last call as a *Value doesn't quite work. If it is dead-code eliminated, the storage for the Value is reused for some other random instruction. Its live variable information, if it is available at all, is wrong. Instead, just mark all the open-defer argument slots as live throughout the function. (They are already zero-initialized.) Fixes #40629 Change-Id: Ie456c7db3082d0de57eaa5234a0f32525a1cce13 Reviewed-on: https://go-review.googlesource.com/c/go/+/247522 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/func.go')
-rw-r--r--src/cmd/compile/internal/ssa/func.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go
index 7cf72a8e37..4b9189fb3e 100644
--- a/src/cmd/compile/internal/ssa/func.go
+++ b/src/cmd/compile/internal/ssa/func.go
@@ -33,15 +33,8 @@ type Func struct {
Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID)
Entry *Block // the entry basic block
- // If we are using open-coded defers, this is the first call to a deferred
- // function in the final defer exit sequence that we generated. This call
- // should be after all defer statements, and will have all args, etc. of
- // all defer calls as live. The liveness info of this call will be used
- // for the deferreturn/ret segment generated for functions with open-coded
- // defers.
- LastDeferExit *Value
- bid idAlloc // block ID allocator
- vid idAlloc // value ID allocator
+ bid idAlloc // block ID allocator
+ vid idAlloc // value ID allocator
// Given an environment variable used for debug hash match,
// what file (if any) receives the yes/no logging?