aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorYoulin Feng <fengyoulin@live.com>2025-09-01 18:31:29 +0800
committerGopher Robot <gobot@golang.org>2025-09-04 07:25:26 -0700
commitdf290384864c0b3cbb557ef11fc95a29d52f6aca (patch)
treee9d188db9c4620d674f8b443934568b68a1c6465 /test/codegen
parent4373754bc990fc13b27ae823f977bc6328cc331e (diff)
downloadgo-df290384864c0b3cbb557ef11fc95a29d52f6aca.tar.xz
cmd/compile/internal/ssa: load constant values from abi.PtrType.Elem
This CL makes the generated code for reflect.TypeFor as simple as an intrinsic function. Fixes #75203 Change-Id: I7bb48787101f07e77ab5c583292e834c28a028d6 Reviewed-on: https://go-review.googlesource.com/c/go/+/700336 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/issue75203.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/codegen/issue75203.go b/test/codegen/issue75203.go
new file mode 100644
index 0000000000..68e1794120
--- /dev/null
+++ b/test/codegen/issue75203.go
@@ -0,0 +1,22 @@
+// asmcheck
+
+// 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 codegen
+
+import "reflect"
+
+func f() reflect.Type {
+ // amd64:`LEAQ\stype:\*int\(SB\)`
+ // arm64:`MOVD\s\$type:\*int\(SB\)`
+ return reflect.TypeFor[*int]()
+}
+
+func g() reflect.Type {
+ // amd64:`LEAQ\stype:int\(SB\)`
+ // arm64:`MOVD\s\$type:int\(SB\)`
+ return reflect.TypeFor[int]()
+}
+