]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile: remove go117ExportTypes constant
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 28 Apr 2022 18:08:40 +0000 (01:08 +0700)
committerGopher Robot <gobot@golang.org>
Thu, 28 Apr 2022 18:41:22 +0000 (18:41 +0000)
Now, 1.17 is the least supported version, the compiler always write
type information when exporting function bodies. So we can get rid of
go117ExportTypes constant and all its conditional checking codes.

Change-Id: I9ac616509c30601e94f99426049d814328253395
Reviewed-on: https://go-review.googlesource.com/c/go/+/402974
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/typecheck/func.go
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go

index 486a6ad31923e449948bbd1ad38a879f46a41825..1fbda92418d5ab1dc97370d233fc685c8301f7de 100644 (file)
@@ -934,10 +934,6 @@ func oldInline(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.InlinedCallExpr
        lab := ir.NewLabelStmt(base.Pos, retlabel)
        body = append(body, lab)
 
-       if !typecheck.Go117ExportTypes {
-               typecheck.Stmts(body)
-       }
-
        if base.Flag.GenDwarfInl > 0 {
                for _, v := range inlfvars {
                        v.SetPos(subst.updatedPos(v.Pos()))
index 6bfa7e6d83911eaa2fa684c5cc36b35087dee5a1..2db1ae344cabf0c05ad76a7cc2804c534cea4321 100644 (file)
@@ -187,19 +187,6 @@ func ImportedBody(fn *ir.Func) {
                fmt.Printf("typecheck import [%v] %L { %v }\n", fn.Sym(), fn, ir.Nodes(fn.Inl.Body))
        }
 
-       if !go117ExportTypes {
-               // If we didn't export & import types, typecheck the code here.
-               savefn := ir.CurFunc
-               ir.CurFunc = fn
-               if inTypeCheckInl {
-                       base.Fatalf("inTypeCheckInl should not be set recursively")
-               }
-               inTypeCheckInl = true
-               Stmts(fn.Inl.Body)
-               inTypeCheckInl = false
-               ir.CurFunc = savefn
-       }
-
        base.Pos = lno
 }
 
index b2188a20fe5178d4d94d9b47828309426efa46b2..f273d26fb0d4ff19af0248c0ac17d4272a6c9fe1 100644 (file)
@@ -1590,11 +1590,7 @@ func (w *exportWriter) stmt(n ir.Node) {
 
        case ir.OAS2, ir.OAS2DOTTYPE, ir.OAS2FUNC, ir.OAS2MAPR, ir.OAS2RECV:
                n := n.(*ir.AssignListStmt)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OAS2)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.stmtList(n.Init())
                w.exprList(n.Lhs)
@@ -1759,9 +1755,7 @@ func (w *exportWriter) expr(n ir.Node) {
                        // Indicate that this is not an OKEY entry.
                        w.bool(false)
                        w.qualifiedIdent(n)
-                       if go117ExportTypes {
-                               w.typ(n.Type())
-                       }
+                       w.typ(n.Type())
                        break
                }
 
@@ -1790,9 +1784,7 @@ func (w *exportWriter) expr(n ir.Node) {
                s := n.Sym()
                w.string(s.Name)
                w.pkg(s.Pkg)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        // case OPACK:
        //      should have been resolved by typechecking - handled by default case
@@ -1864,16 +1856,10 @@ func (w *exportWriter) expr(n ir.Node) {
 
        case ir.OPTRLIT:
                n := n.(*ir.AddrExpr)
-               if go117ExportTypes {
-                       w.op(ir.OPTRLIT)
-               } else {
-                       w.op(ir.OADDR)
-               }
+               w.op(ir.OPTRLIT)
                w.pos(n.Pos())
                w.expr(n.X)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OSTRUCTLIT:
                n := n.(*ir.CompLitExpr)
@@ -1884,15 +1870,11 @@ func (w *exportWriter) expr(n ir.Node) {
 
        case ir.OCOMPLIT, ir.OARRAYLIT, ir.OSLICELIT, ir.OMAPLIT:
                n := n.(*ir.CompLitExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OCOMPLIT)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.typ(n.Type())
                w.exprList(n.List)
-               if go117ExportTypes && n.Op() == ir.OSLICELIT {
+               if n.Op() == ir.OSLICELIT {
                        w.uint64(uint64(n.Len))
                }
        case ir.OKEY:
@@ -1907,37 +1889,25 @@ func (w *exportWriter) expr(n ir.Node) {
 
        case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
                n := n.(*ir.SelectorExpr)
-               if go117ExportTypes {
-                       // For go117ExportTypes, we usually see all ops except
-                       // OXDOT, but we can see OXDOT for generic functions.
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OXDOT)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
                w.exoticSelector(n.Sel)
-               if go117ExportTypes {
-                       w.exoticType(n.Type())
-                       if n.Op() == ir.OXDOT {
-                               // n.Selection for method references will be
-                               // reconstructed during import.
-                               w.bool(n.Selection != nil)
-                       } else if n.Op() == ir.ODOT || n.Op() == ir.ODOTPTR || n.Op() == ir.ODOTINTER {
-                               w.exoticField(n.Selection)
-                       }
-                       // n.Selection is not required for OMETHEXPR, ODOTMETH, and OMETHVALUE. It will
-                       // be reconstructed during import.  n.Selection is computed during
-                       // transformDot() for OXDOT.
-               }
+               w.exoticType(n.Type())
+               if n.Op() == ir.OXDOT {
+                       // n.Selection for method references will be
+                       // reconstructed during import.
+                       w.bool(n.Selection != nil)
+               } else if n.Op() == ir.ODOT || n.Op() == ir.ODOTPTR || n.Op() == ir.ODOTINTER {
+                       w.exoticField(n.Selection)
+               }
+               // n.Selection is not required for OMETHEXPR, ODOTMETH, and OMETHVALUE. It will
+               // be reconstructed during import.  n.Selection is computed during
+               // transformDot() for OXDOT.
 
        case ir.ODOTTYPE, ir.ODOTTYPE2:
                n := n.(*ir.TypeAssertExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.ODOTTYPE)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
                w.typ(n.Type())
@@ -1952,49 +1922,31 @@ func (w *exportWriter) expr(n ir.Node) {
 
        case ir.OINDEX, ir.OINDEXMAP:
                n := n.(*ir.IndexExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OINDEX)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
                w.expr(n.Index)
-               if go117ExportTypes {
-                       w.exoticType(n.Type())
-                       if n.Op() == ir.OINDEXMAP {
-                               w.bool(n.Assigned)
-                       }
+               w.exoticType(n.Type())
+               if n.Op() == ir.OINDEXMAP {
+                       w.bool(n.Assigned)
                }
 
        case ir.OSLICE, ir.OSLICESTR, ir.OSLICEARR:
                n := n.(*ir.SliceExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OSLICE)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
                w.exprsOrNil(n.Low, n.High)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OSLICE3, ir.OSLICE3ARR:
                n := n.(*ir.SliceExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OSLICE3)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
                w.exprsOrNil(n.Low, n.High)
                w.expr(n.Max)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OCOPY, ir.OCOMPLEX, ir.OUNSAFEADD, ir.OUNSAFESLICE:
                // treated like other builtin calls (see e.g., OREAL)
@@ -2004,19 +1956,11 @@ func (w *exportWriter) expr(n ir.Node) {
                w.stmtList(n.Init())
                w.expr(n.X)
                w.expr(n.Y)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               } else {
-                       w.op(ir.OEND)
-               }
+               w.typ(n.Type())
 
        case ir.OCONV, ir.OCONVIFACE, ir.OCONVIDATA, ir.OCONVNOP, ir.OBYTES2STR, ir.ORUNES2STR, ir.OSTR2BYTES, ir.OSTR2RUNES, ir.ORUNESTR, ir.OSLICE2ARRPTR:
                n := n.(*ir.ConvExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OCONV)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.typ(n.Type())
                w.expr(n.X)
@@ -2026,12 +1970,8 @@ func (w *exportWriter) expr(n ir.Node) {
                w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
-               if go117ExportTypes {
-                       if n.Op() != ir.OPANIC {
-                               w.typ(n.Type())
-                       }
-               } else {
-                       w.op(ir.OEND)
+               if n.Op() != ir.OPANIC {
+                       w.typ(n.Type())
                }
 
        case ir.OAPPEND, ir.ODELETE, ir.ORECOVER, ir.OPRINT, ir.OPRINTN:
@@ -2046,27 +1986,19 @@ func (w *exportWriter) expr(n ir.Node) {
                } else if n.IsDDD {
                        base.Fatalf("exporter: unexpected '...' with %v call", n.Op())
                }
-               if go117ExportTypes {
-                       if n.Op() != ir.ODELETE && n.Op() != ir.OPRINT && n.Op() != ir.OPRINTN {
-                               w.typ(n.Type())
-                       }
+               if n.Op() != ir.ODELETE && n.Op() != ir.OPRINT && n.Op() != ir.OPRINTN {
+                       w.typ(n.Type())
                }
 
        case ir.OCALL, ir.OCALLFUNC, ir.OCALLMETH, ir.OCALLINTER, ir.OGETG:
                n := n.(*ir.CallExpr)
-               if go117ExportTypes {
-                       w.op(n.Op())
-               } else {
-                       w.op(ir.OCALL)
-               }
+               w.op(n.Op())
                w.pos(n.Pos())
                w.stmtList(n.Init())
                w.expr(n.X)
                w.exprList(n.Args)
                w.bool(n.IsDDD)
-               if go117ExportTypes {
-                       w.exoticType(n.Type())
-               }
+               w.exoticType(n.Type())
 
        case ir.OMAKEMAP, ir.OMAKECHAN, ir.OMAKESLICE:
                n := n.(*ir.MakeExpr)
@@ -2087,7 +2019,7 @@ func (w *exportWriter) expr(n ir.Node) {
                        // an argument. Don't serialize that argument here.
                        w.expr(n.Len)
                        w.op(ir.OEND)
-               case n.Len != nil && go117ExportTypes:
+               case n.Len != nil:
                        w.expr(n.Len)
                        w.op(ir.OEND)
                }
@@ -2106,27 +2038,21 @@ func (w *exportWriter) expr(n ir.Node) {
                w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OADDR:
                n := n.(*ir.AddrExpr)
                w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.ODEREF:
                n := n.(*ir.StarExpr)
                w.op(n.Op())
                w.pos(n.Pos())
                w.expr(n.X)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OSEND:
                n := n.(*ir.SendStmt)
@@ -2143,9 +2069,7 @@ func (w *exportWriter) expr(n ir.Node) {
                w.pos(n.Pos())
                w.expr(n.X)
                w.expr(n.Y)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OANDAND, ir.OOROR:
                n := n.(*ir.LogicalExpr)
@@ -2153,18 +2077,14 @@ func (w *exportWriter) expr(n ir.Node) {
                w.pos(n.Pos())
                w.expr(n.X)
                w.expr(n.Y)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OADDSTR:
                n := n.(*ir.AddStringExpr)
                w.op(ir.OADDSTR)
                w.pos(n.Pos())
                w.exprList(n.List)
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.ODCLCONST:
                // if exporting, DCLCONST should just be removed as its usage
@@ -2179,9 +2099,7 @@ func (w *exportWriter) expr(n ir.Node) {
                for _, targ := range n.Targs {
                        w.typ(targ.Type())
                }
-               if go117ExportTypes {
-                       w.typ(n.Type())
-               }
+               w.typ(n.Type())
 
        case ir.OSELRECV2:
                n := n.(*ir.AssignListStmt)
@@ -2297,15 +2215,5 @@ func (w *intWriter) uint64(x uint64) {
        w.Write(buf[:n])
 }
 
-// If go117ExportTypes is true, then we write type information when
-// exporting function bodies, so those function bodies don't need to
-// be re-typechecked on import.
-// This flag adds some other info to the serialized stream as well
-// which was previously recomputed during typechecking, like
-// specializing opcodes (e.g. OXDOT to ODOTPTR) and ancillary
-// information (e.g. length field for OSLICELIT).
-const go117ExportTypes = true
-const Go117ExportTypes = go117ExportTypes
-
 // The name used for dictionary parameters or local variables.
 const LocalDictName = ".dict"
index 2cf9698980857a1c3b5381420ea3af81ef920daa..7ce613ca972c22502425d75f3c31ddb7e8447375 100644 (file)
@@ -1137,11 +1137,9 @@ func (r *importReader) funcBody(fn *ir.Func) {
                // functions).
                body = []ir.Node{}
        }
-       if go117ExportTypes {
-               ir.VisitList(body, func(n ir.Node) {
-                       n.SetTypecheck(1)
-               })
-       }
+       ir.VisitList(body, func(n ir.Node) {
+               n.SetTypecheck(1)
+       })
        fn.Inl.Body = body
 
        r.curfn = outerfn
@@ -1319,19 +1317,15 @@ func (r *importReader) node() ir.Node {
 
        case ir.ONONAME:
                isKey := r.bool()
-               n := r.qualifiedIdent()
-               if go117ExportTypes {
-                       var n2 ir.Node = n
-                       // Key ONONAME entries should not be resolved - they should
-                       // stay as identifiers.
-                       if !isKey {
-                               n2 = Resolve(n)
-                       }
-                       typ := r.typ()
-                       if n2.Type() == nil {
-                               n2.SetType(typ)
-                       }
-                       return n2
+               var n ir.Node = r.qualifiedIdent()
+               // Key ONONAME entries should not be resolved - they should
+               // stay as identifiers.
+               if !isKey {
+                       n = Resolve(n)
+               }
+               typ := r.typ()
+               if n.Type() == nil {
+                       n.SetType(typ)
                }
                return n
 
@@ -1386,7 +1380,7 @@ func (r *importReader) node() ir.Node {
                cvars := make([]*ir.Name, r.int64())
                for i := range cvars {
                        cvars[i] = ir.CaptureName(r.pos(), fn, r.localName().Canonical())
-                       if go117ExportTypes && cvars[i].Defn == nil {
+                       if cvars[i].Defn == nil {
                                base.Fatalf("bad import of closure variable")
                        }
                }
@@ -1409,21 +1403,16 @@ func (r *importReader) node() ir.Node {
                ir.FinishCaptureNames(pos, r.curfn, fn)
 
                clo := fn.OClosure
-               if go117ExportTypes {
-                       clo.SetType(typ)
-               }
+               clo.SetType(typ)
                return clo
 
        case ir.OSTRUCTLIT:
-               if go117ExportTypes {
-                       pos := r.pos()
-                       typ := r.typ()
-                       list := r.fieldList()
-                       n := ir.NewCompLitExpr(pos, ir.OSTRUCTLIT, nil, list)
-                       n.SetType(typ)
-                       return n
-               }
-               return ir.NewCompLitExpr(r.pos(), ir.OCOMPLIT, ir.TypeNode(r.typ()), r.fieldList())
+               pos := r.pos()
+               typ := r.typ()
+               list := r.fieldList()
+               n := ir.NewCompLitExpr(pos, ir.OSTRUCTLIT, nil, list)
+               n.SetType(typ)
+               return n
 
        case ir.OCOMPLIT:
                pos := r.pos()
@@ -1433,10 +1422,6 @@ func (r *importReader) node() ir.Node {
                return n
 
        case ir.OARRAYLIT, ir.OSLICELIT, ir.OMAPLIT:
-               if !go117ExportTypes {
-                       // unreachable - mapped to OCOMPLIT by exporter
-                       goto error
-               }
                pos := r.pos()
                typ := r.typ()
                list := r.exprList()
@@ -1454,55 +1439,47 @@ func (r *importReader) node() ir.Node {
        //      unreachable - handled in case OSTRUCTLIT by elemList
 
        case ir.OXDOT, ir.ODOT, ir.ODOTPTR, ir.ODOTINTER, ir.ODOTMETH, ir.OMETHVALUE, ir.OMETHEXPR:
-               // For !go117ExportTypes,  we should only see OXDOT.
-               // For go117ExportTypes, we usually see all the other ops, but can see
-               // OXDOT for generic functions.
-               if op != ir.OXDOT && !go117ExportTypes {
-                       goto error
-               }
                pos := r.pos()
                expr := r.expr()
                sel := r.exoticSelector()
                n := ir.NewSelectorExpr(pos, op, expr, sel)
-               if go117ExportTypes {
-                       n.SetType(r.exoticType())
-                       switch op {
-                       case ir.OXDOT:
-                               hasSelection := r.bool()
-                               // We reconstruct n.Selection for method calls on
-                               // generic types and method calls due to type param
-                               // bounds.  Otherwise, n.Selection is nil.
-                               if hasSelection {
-                                       n1 := ir.NewSelectorExpr(pos, op, expr, sel)
-                                       AddImplicitDots(n1)
-                                       var m *types.Field
-                                       if n1.X.Type().IsTypeParam() {
-                                               genType := n1.X.Type().Bound()
-                                               m = Lookdot1(n1, sel, genType, genType.AllMethods(), 1)
-                                       } else {
-                                               genType := types.ReceiverBaseType(n1.X.Type())
-                                               if genType.IsInstantiatedGeneric() {
-                                                       genType = genType.OrigType()
-                                               }
-                                               m = Lookdot1(n1, sel, genType, genType.Methods(), 1)
+               n.SetType(r.exoticType())
+               switch op {
+               case ir.OXDOT:
+                       hasSelection := r.bool()
+                       // We reconstruct n.Selection for method calls on
+                       // generic types and method calls due to type param
+                       // bounds.  Otherwise, n.Selection is nil.
+                       if hasSelection {
+                               n1 := ir.NewSelectorExpr(pos, op, expr, sel)
+                               AddImplicitDots(n1)
+                               var m *types.Field
+                               if n1.X.Type().IsTypeParam() {
+                                       genType := n1.X.Type().Bound()
+                                       m = Lookdot1(n1, sel, genType, genType.AllMethods(), 1)
+                               } else {
+                                       genType := types.ReceiverBaseType(n1.X.Type())
+                                       if genType.IsInstantiatedGeneric() {
+                                               genType = genType.OrigType()
                                        }
-                                       assert(m != nil)
-                                       n.Selection = m
-                               }
-                       case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER:
-                               n.Selection = r.exoticField()
-                       case ir.OMETHEXPR:
-                               n = typecheckMethodExpr(n).(*ir.SelectorExpr)
-                       case ir.ODOTMETH, ir.OMETHVALUE:
-                               // These require a Lookup to link to the correct declaration.
-                               rcvrType := expr.Type()
-                               typ := n.Type()
-                               n.Selection = Lookdot(n, rcvrType, 1)
-                               if op == ir.OMETHVALUE {
-                                       // Lookdot clobbers the opcode and type, undo that.
-                                       n.SetOp(op)
-                                       n.SetType(typ)
+                                       m = Lookdot1(n1, sel, genType, genType.Methods(), 1)
                                }
+                               assert(m != nil)
+                               n.Selection = m
+                       }
+               case ir.ODOT, ir.ODOTPTR, ir.ODOTINTER:
+                       n.Selection = r.exoticField()
+               case ir.OMETHEXPR:
+                       n = typecheckMethodExpr(n).(*ir.SelectorExpr)
+               case ir.ODOTMETH, ir.OMETHVALUE:
+                       // These require a Lookup to link to the correct declaration.
+                       rcvrType := expr.Type()
+                       typ := n.Type()
+                       n.Selection = Lookdot(n, rcvrType, 1)
+                       if op == ir.OMETHVALUE {
+                               // Lookdot clobbers the opcode and type, undo that.
+                               n.SetOp(op)
+                               n.SetType(typ)
                        }
                }
                return n
@@ -1510,9 +1487,7 @@ func (r *importReader) node() ir.Node {
        case ir.ODOTTYPE, ir.ODOTTYPE2:
                n := ir.NewTypeAssertExpr(r.pos(), r.expr(), nil)
                n.SetType(r.typ())
-               if go117ExportTypes {
-                       n.SetOp(op)
-               }
+               n.SetOp(op)
                return n
 
        case ir.ODYNAMICDOTTYPE, ir.ODYNAMICDOTTYPE2:
@@ -1522,12 +1497,10 @@ func (r *importReader) node() ir.Node {
 
        case ir.OINDEX, ir.OINDEXMAP:
                n := ir.NewIndexExpr(r.pos(), r.expr(), r.expr())
-               if go117ExportTypes {
-                       n.SetOp(op)
-                       n.SetType(r.exoticType())
-                       if op == ir.OINDEXMAP {
-                               n.Assigned = r.bool()
-                       }
+               n.SetOp(op)
+               n.SetType(r.exoticType())
+               if op == ir.OINDEXMAP {
+                       n.Assigned = r.bool()
                }
                return n
 
@@ -1539,96 +1512,65 @@ func (r *importReader) node() ir.Node {
                        max = r.expr()
                }
                n := ir.NewSliceExpr(pos, op, x, low, high, max)
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        case ir.OCONV, ir.OCONVIFACE, ir.OCONVIDATA, ir.OCONVNOP, ir.OBYTES2STR, ir.ORUNES2STR, ir.OSTR2BYTES, ir.OSTR2RUNES, ir.ORUNESTR, ir.OSLICE2ARRPTR:
-               if !go117ExportTypes && op != ir.OCONV {
-                       //      unreachable - mapped to OCONV case by exporter
-                       goto error
-               }
                return ir.NewConvExpr(r.pos(), op, r.typ(), r.expr())
 
        case ir.OCOPY, ir.OCOMPLEX, ir.OREAL, ir.OIMAG, ir.OAPPEND, ir.OCAP, ir.OCLOSE, ir.ODELETE, ir.OLEN, ir.OMAKE, ir.ONEW, ir.OPANIC, ir.ORECOVER, ir.OPRINT, ir.OPRINTN, ir.OUNSAFEADD, ir.OUNSAFESLICE:
                pos := r.pos()
-               if go117ExportTypes {
-                       switch op {
-                       case ir.OCOPY, ir.OCOMPLEX, ir.OUNSAFEADD, ir.OUNSAFESLICE:
-                               init := r.stmtList()
-                               n := ir.NewBinaryExpr(pos, op, r.expr(), r.expr())
-                               n.SetInit(init)
+               switch op {
+               case ir.OCOPY, ir.OCOMPLEX, ir.OUNSAFEADD, ir.OUNSAFESLICE:
+                       init := r.stmtList()
+                       n := ir.NewBinaryExpr(pos, op, r.expr(), r.expr())
+                       n.SetInit(init)
+                       n.SetType(r.typ())
+                       return n
+               case ir.OREAL, ir.OIMAG, ir.OCAP, ir.OCLOSE, ir.OLEN, ir.ONEW, ir.OPANIC:
+                       n := ir.NewUnaryExpr(pos, op, r.expr())
+                       if op != ir.OPANIC {
                                n.SetType(r.typ())
-                               return n
-                       case ir.OREAL, ir.OIMAG, ir.OCAP, ir.OCLOSE, ir.OLEN, ir.ONEW, ir.OPANIC:
-                               n := ir.NewUnaryExpr(pos, op, r.expr())
-                               if op != ir.OPANIC {
-                                       n.SetType(r.typ())
-                               }
-                               return n
-                       case ir.OAPPEND, ir.ODELETE, ir.ORECOVER, ir.OPRINT, ir.OPRINTN:
-                               init := r.stmtList()
-                               n := ir.NewCallExpr(pos, op, nil, r.exprList())
-                               n.SetInit(init)
-                               if op == ir.OAPPEND {
-                                       n.IsDDD = r.bool()
-                               }
-                               if op == ir.OAPPEND || op == ir.ORECOVER {
-                                       n.SetType(r.typ())
-                               }
-                               return n
                        }
-                       // ir.OMAKE
-                       goto error
-               }
-               n := builtinCall(pos, op)
-               switch n.Op() {
-               case ir.OCOPY, ir.OCOMPLEX, ir.OUNSAFEADD, ir.OUNSAFESLICE:
-                       // treated like other builtin calls
-                       fallthrough
+                       return n
                case ir.OAPPEND, ir.ODELETE, ir.ORECOVER, ir.OPRINT, ir.OPRINTN:
-                       n.SetInit(r.stmtList())
-               }
-               n.Args = r.exprList()
-               if op == ir.OAPPEND {
-                       n.IsDDD = r.bool()
+                       init := r.stmtList()
+                       n := ir.NewCallExpr(pos, op, nil, r.exprList())
+                       n.SetInit(init)
+                       if op == ir.OAPPEND {
+                               n.IsDDD = r.bool()
+                       }
+                       if op == ir.OAPPEND || op == ir.ORECOVER {
+                               n.SetType(r.typ())
+                       }
+                       return n
                }
-               return n
+               // ir.OMAKE
+               goto error
 
        case ir.OCALL, ir.OCALLFUNC, ir.OCALLMETH, ir.OCALLINTER, ir.OGETG:
                pos := r.pos()
                init := r.stmtList()
                n := ir.NewCallExpr(pos, ir.OCALL, r.expr(), r.exprList())
-               if go117ExportTypes {
-                       n.SetOp(op)
-               }
+               n.SetOp(op)
                n.SetInit(init)
                n.IsDDD = r.bool()
-               if go117ExportTypes {
-                       n.SetType(r.exoticType())
-               }
+               n.SetType(r.exoticType())
                return n
 
        case ir.OMAKEMAP, ir.OMAKECHAN, ir.OMAKESLICE:
-               if go117ExportTypes {
-                       pos := r.pos()
-                       typ := r.typ()
-                       list := r.exprList()
-                       var len_, cap_ ir.Node
-                       if len(list) > 0 {
-                               len_ = list[0]
-                       }
-                       if len(list) > 1 {
-                               cap_ = list[1]
-                       }
-                       n := ir.NewMakeExpr(pos, op, len_, cap_)
-                       n.SetType(typ)
-                       return n
+               pos := r.pos()
+               typ := r.typ()
+               list := r.exprList()
+               var len_, cap_ ir.Node
+               if len(list) > 0 {
+                       len_ = list[0]
+               }
+               if len(list) > 1 {
+                       cap_ = list[1]
                }
-               n := builtinCall(r.pos(), ir.OMAKE)
-               n.Args.Append(ir.TypeNode(r.typ()))
-               n.Args.Append(r.exprList()...)
+               n := ir.NewMakeExpr(pos, op, len_, cap_)
+               n.SetType(typ)
                return n
 
        case ir.OLINKSYMOFFSET:
@@ -1641,45 +1583,33 @@ func (r *importReader) node() ir.Node {
        // unary expressions
        case ir.OPLUS, ir.ONEG, ir.OBITNOT, ir.ONOT, ir.ORECV, ir.OIDATA:
                n := ir.NewUnaryExpr(r.pos(), op, r.expr())
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        case ir.OADDR, ir.OPTRLIT:
-               if go117ExportTypes {
-                       pos := r.pos()
-                       expr := r.expr()
-                       expr.SetTypecheck(1) // we do this for all nodes after importing, but do it now so markAddrOf can see it.
-                       n := NodAddrAt(pos, expr)
-                       n.SetOp(op)
-                       n.SetType(r.typ())
-                       return n
-               }
-               n := NodAddrAt(r.pos(), r.expr())
+               pos := r.pos()
+               expr := r.expr()
+               expr.SetTypecheck(1) // we do this for all nodes after importing, but do it now so markAddrOf can see it.
+               n := NodAddrAt(pos, expr)
+               n.SetOp(op)
+               n.SetType(r.typ())
                return n
 
        case ir.ODEREF:
                n := ir.NewStarExpr(r.pos(), r.expr())
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        // binary expressions
        case ir.OADD, ir.OAND, ir.OANDNOT, ir.ODIV, ir.OEQ, ir.OGE, ir.OGT, ir.OLE, ir.OLT,
                ir.OLSH, ir.OMOD, ir.OMUL, ir.ONE, ir.OOR, ir.ORSH, ir.OSUB, ir.OXOR, ir.OEFACE:
                n := ir.NewBinaryExpr(r.pos(), op, r.expr(), r.expr())
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        case ir.OANDAND, ir.OOROR:
                n := ir.NewLogicalExpr(r.pos(), op, r.expr(), r.expr())
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        case ir.OSEND:
@@ -1688,16 +1618,9 @@ func (r *importReader) node() ir.Node {
        case ir.OADDSTR:
                pos := r.pos()
                list := r.exprList()
-               if go117ExportTypes {
-                       n := ir.NewAddStringExpr(pos, list)
-                       n.SetType(r.typ())
-                       return n
-               }
-               x := list[0]
-               for _, y := range list[1:] {
-                       x = ir.NewBinaryExpr(pos, ir.OADD, x, y)
-               }
-               return x
+               n := ir.NewAddStringExpr(pos, list)
+               n.SetType(r.typ())
+               return n
 
        // --------------------------------------------------------------------
        // statements
@@ -1730,10 +1653,6 @@ func (r *importReader) node() ir.Node {
                return n
 
        case ir.OAS2, ir.OAS2DOTTYPE, ir.OAS2FUNC, ir.OAS2MAPR, ir.OAS2RECV:
-               if !go117ExportTypes && op != ir.OAS2 {
-                       // unreachable - mapped to case OAS2 by exporter
-                       goto error
-               }
                pos := r.pos()
                init := r.stmtList()
                n := ir.NewAssignListStmt(pos, op, r.exprList(), r.exprList())
@@ -1820,9 +1739,7 @@ func (r *importReader) node() ir.Node {
                        }
                }
                n := ir.NewInstExpr(pos, ir.OFUNCINST, x, targs)
-               if go117ExportTypes {
-                       n.SetType(r.typ())
-               }
+               n.SetType(r.typ())
                return n
 
        case ir.OSELRECV2:
@@ -1870,14 +1787,6 @@ func (r *importReader) exprsOrNil() (a, b ir.Node) {
        return
 }
 
-func builtinCall(pos src.XPos, op ir.Op) *ir.CallExpr {
-       if go117ExportTypes {
-               // These should all be encoded as direct ops, not OCALL.
-               base.Fatalf("builtinCall should not be invoked when types are included in import/export")
-       }
-       return ir.NewCallExpr(pos, ir.OCALL, ir.NewIdent(base.Pos, types.BuiltinPkg.Lookup(ir.OpNames[op])), nil)
-}
-
 // NewIncompleteNamedType returns a TFORW type t with name specified by sym, such
 // that t.nod and sym.Def are set correctly. If there are any RParams for the type,
 // they should be set soon after creating the TFORW type, before creating the