]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: ensure ops have the expected argument widths
authorKeith Randall <khr@golang.org>
Thu, 18 Dec 2025 20:29:39 +0000 (12:29 -0800)
committerKeith Randall <khr@golang.org>
Thu, 22 Jan 2026 22:36:07 +0000 (14:36 -0800)
commit819c53c25f2992113c202644045b93bd3a578f54
treea81980685823d79b0545000e3315e4cea62ddec6
parentc7258178cda55e3903ad8e4b6cc51861fb689457
cmd/compile: ensure ops have the expected argument widths

The generic SSA representation uses explicit extension and
truncation operations to change widths of values. The map
intrinsics were playing somewhat fast and loose with this
requirement. Fix that, and add a check to make sure we
don't regress.

I don't think there is a triggerable bug here, but I ran into
this with some prove pass modifications, where
cmd/compile/internal/ssa/prove.go:isCleanExt (and/or its uses)
is actually wrong when this invariant is not maintained.

Change-Id: Idb7be6e691e2dbf6d7af6584641c3227c5c64bf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/731300
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/ssa/_gen/divmod.rules
src/cmd/compile/internal/ssa/_gen/generic.rules
src/cmd/compile/internal/ssa/check.go
src/cmd/compile/internal/ssa/rewritedivmod.go
src/cmd/compile/internal/ssagen/intrinsics.go