Skip to content

Commit bf88cde

Browse files
ydnardeadprogram
authored andcommitted
transform: cherry-pick from #4774
1 parent c8d0b87 commit bf88cde

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

transform/rtcalls.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ func OptimizeStringEqual(mod llvm.Module) {
117117
// As of this writing, the (reflect.Type).Interface method has not yet been
118118
// implemented so this optimization is critical for the encoding/json package.
119119
func OptimizeReflectImplements(mod llvm.Module) {
120-
implementsSignature := mod.NamedGlobal("reflect/methods.Implements(reflect.Type) bool")
121-
if implementsSignature.IsNil() {
120+
implementsSignature1 := mod.NamedGlobal("reflect/methods.Implements(reflect.Type) bool")
121+
implementsSignature2 := mod.NamedGlobal("reflect/methods.Implements(internal/reflectlite.Type) bool")
122+
if implementsSignature1.IsNil() && implementsSignature2.IsNil() {
122123
return
123124
}
124125

@@ -132,7 +133,8 @@ func OptimizeReflectImplements(mod llvm.Module) {
132133
if attr.IsNil() {
133134
continue
134135
}
135-
if attr.GetStringValue() == "reflect/methods.Implements(reflect.Type) bool" {
136+
val := attr.GetStringValue()
137+
if val == "reflect/methods.Implements(reflect.Type) bool" || val == "reflect/methods.Implements(internal/reflectlite.Type) bool" {
136138
implementsFunc = fn
137139
break
138140
}

0 commit comments

Comments
 (0)