]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't elide zero extension on top of signed values
authorKeith Randall <khr@golang.org>
Fri, 28 Jun 2024 03:45:22 +0000 (20:45 -0700)
committerKeith Randall <khr@golang.org>
Fri, 28 Jun 2024 15:25:43 +0000 (15:25 +0000)
commit7f90b960a9711b51bf36f49be4274ac5f7e86a95
tree6c4dedad9273fc181797eee8c5727a167dcb4157
parentea537cca314d9da5365eeefcc375410c76e93b36
cmd/compile: don't elide zero extension on top of signed values

v = ... compute some value, which zeros top 32 bits ...
w = zero-extend v

We want to remove the zero-extension operation, as it doesn't do anything.
But if v is typed as a signed value, and it gets spilled/restored, it
might be re-sign-extended upon restore. So the zero-extend isn't actually
a NOP when there might be calls or other reasons to spill in between v and w.

Fixes #68227

Change-Id: I3b30b8e56c7d70deac1fb09d2becc7395acbadf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/595675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joedian Reid <joedian@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/ssa/rewrite.go
test/fixedbugs/issue68227.go [new file with mode: 0644]