diff options
| author | Keith Randall <khr@golang.org> | 2025-08-11 17:31:03 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2025-08-11 22:36:26 -0700 |
| commit | c31359138ca5078f33eb697f71fd280ca1889593 (patch) | |
| tree | 7b2db0ad800f8e3833eac90756e099c7d7f840aa /src/cmd | |
| parent | 7248995b608cdf62362c1b95550edc0bdd15babe (diff) | |
| download | go-c31359138ca5078f33eb697f71fd280ca1889593.tar.xz | |
Revert "cmd/compile: allow StructSelect [x] of interface data fields for x>0"
This reverts commit bcd25c79aa5675d3e5d28c09715b8147906da006 (CL 693415)
Reason for revert: still causing compiler failures on Google test code
Change-Id: I887edcff56bde3ffa316f2b629021ad323a357fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/694996
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/compile/internal/ssa/_gen/dec.rules | 4 | ||||
| -rw-r--r-- | src/cmd/compile/internal/ssa/rewritedec.go | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/_gen/dec.rules b/src/cmd/compile/internal/ssa/_gen/dec.rules index d3052b2a5b..5309a7f6b4 100644 --- a/src/cmd/compile/internal/ssa/_gen/dec.rules +++ b/src/cmd/compile/internal/ssa/_gen/dec.rules @@ -98,7 +98,7 @@ // Some of these are copied from generic.rules (IMake _typ (StructMake val)) => (IMake _typ val) -(StructSelect (IData x)) => (IData x) +(StructSelect [0] (IData x)) => (IData x) (StructSelect [i] x:(StructMake ___)) => x.Args[i] @@ -109,7 +109,7 @@ // More annoying case: (ArraySelect[0] (StructSelect[0] isAPtr)) // There, result of the StructSelect is an Array (not a pointer) and // the pre-rewrite input to the ArraySelect is a struct, not a pointer. -(StructSelect x) && x.Type.IsPtrShaped() => x +(StructSelect [0] x) && x.Type.IsPtrShaped() => x (ArraySelect [0] x) && x.Type.IsPtrShaped() => x // These, too. Bits is bits. diff --git a/src/cmd/compile/internal/ssa/rewritedec.go b/src/cmd/compile/internal/ssa/rewritedec.go index bdbda1aaa8..16d0269210 100644 --- a/src/cmd/compile/internal/ssa/rewritedec.go +++ b/src/cmd/compile/internal/ssa/rewritedec.go @@ -839,10 +839,10 @@ func rewriteValuedec_OpStructMake(v *Value) bool { func rewriteValuedec_OpStructSelect(v *Value) bool { v_0 := v.Args[0] b := v.Block - // match: (StructSelect (IData x)) + // match: (StructSelect [0] (IData x)) // result: (IData x) for { - if v_0.Op != OpIData { + if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpIData { break } x := v_0.Args[0] @@ -861,10 +861,13 @@ func rewriteValuedec_OpStructSelect(v *Value) bool { v.copyOf(x.Args[i]) return true } - // match: (StructSelect x) + // match: (StructSelect [0] x) // cond: x.Type.IsPtrShaped() // result: x for { + if auxIntToInt64(v.AuxInt) != 0 { + break + } x := v_0 if !(x.Type.IsPtrShaped()) { break |
