@@ -109,28 +109,29 @@ class EmitBBArguments : public CanTypeVisitor<EmitBBArguments,
109109
110110 // This can happen if the value is resilient in the calling convention
111111 // but not resilient locally.
112- if (argType.isLoadable (SGF.F )) {
112+ bool argIsLoadable = argType.isLoadable (SGF.F );
113+ if (argIsLoadable) {
113114 if (argType.isAddress ()) {
114115 if (mv.isPlusOne (SGF))
115116 mv = SGF.B .createLoadTake (loc, mv);
116117 else
117118 mv = SGF.B .createLoadBorrow (loc, mv);
118119 argType = argType.getObjectType ();
119120 }
120- } else {
121- if (isNoImplicitCopy) {
122- // We do not support no implicit copy address only types. Emit an error.
123- auto diag = diag::noimplicitcopy_used_on_generic_or_existential;
124- diagnose (SGF.getASTContext (), mv.getValue ().getLoc ().getSourceLoc (),
125- diag);
126- }
127121 }
128122
129123 if (argType.getASTType () != paramType.getASTType ()) {
130124 // Reabstract the value if necessary.
131125 mv = SGF.emitOrigToSubstValue (loc, mv.ensurePlusOne (SGF, loc), orig, t);
132126 }
133127
128+ if (isNoImplicitCopy && !argIsLoadable) {
129+ // We do not support no implicit copy address only types. Emit an error.
130+ auto diag = diag::noimplicitcopy_used_on_generic_or_existential;
131+ diagnose (SGF.getASTContext (), mv.getValue ().getLoc ().getSourceLoc (),
132+ diag);
133+ }
134+
134135 // If the value is a (possibly optional) ObjC block passed into the entry
135136 // point of the function, then copy it so we can treat the value reliably
136137 // as a heap object. Escape analysis can eliminate this copy if it's
0 commit comments