@@ -284,6 +284,16 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
284
284
super::visitCopyValueInst (Copy);
285
285
}
286
286
287
+ void visitExplicitCopyValueInst (ExplicitCopyValueInst *Copy) {
288
+ // If the substituted type is trivial, ignore the copy.
289
+ SILType copyTy = getOpType (Copy->getType ());
290
+ if (copyTy.isTrivial (*Copy->getFunction ())) {
291
+ recordFoldedValue (SILValue (Copy), getOpValue (Copy->getOperand ()));
292
+ return ;
293
+ }
294
+ super::visitExplicitCopyValueInst (Copy);
295
+ }
296
+
287
297
void visitDestroyValueInst (DestroyValueInst *Destroy) {
288
298
// If the substituted type is trivial, ignore the destroy.
289
299
SILType destroyTy = getOpType (Destroy->getOperand ()->getType ());
@@ -293,6 +303,24 @@ class TypeSubstCloner : public SILClonerWithScopes<ImplClass> {
293
303
super::visitDestroyValueInst (Destroy);
294
304
}
295
305
306
+ void visitEndLifetimeInst (EndLifetimeInst *endLifetime) {
307
+ // If the substituted type is trivial, ignore the end_lifetime.
308
+ SILType ty = getOpType (endLifetime->getOperand ()->getType ());
309
+ if (ty.isTrivial (*endLifetime->getFunction ())) {
310
+ return ;
311
+ }
312
+ super::visitEndLifetimeInst (endLifetime);
313
+ }
314
+
315
+ void visitExtendLifetimeInst (ExtendLifetimeInst *extendLifetime) {
316
+ // If the substituted type is trivial, ignore the extend_lifetime.
317
+ SILType ty = getOpType (extendLifetime->getOperand ()->getType ());
318
+ if (ty.isTrivial (*extendLifetime->getFunction ())) {
319
+ return ;
320
+ }
321
+ super::visitExtendLifetimeInst (extendLifetime);
322
+ }
323
+
296
324
void visitDifferentiableFunctionExtractInst (
297
325
DifferentiableFunctionExtractInst *dfei) {
298
326
// If the extractee is the original function, do regular cloning.
0 commit comments