// 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]
// 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.
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]
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
+++ /dev/null
-// compile
-
-// Copyright 2025 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-type P struct {
- q struct{}
- p *int
-}
-
-func f(x any) {
- h(x.(P))
-}
-
-//go:noinline
-func h(P) {
-}