File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
lib/SILOptimizer/Analysis Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -488,7 +488,8 @@ SILValue InstSimplifier::visitMetatypeInst(MetatypeInst *MI) {
488
488
|| instanceType.getStructOrBoundGenericStruct ()
489
489
|| instanceType.getEnumOrBoundGenericEnum ()) {
490
490
for (SILArgument *argument : MI->getFunction ()->getArguments ()) {
491
- if (argument->getType ().getASTType () == metaType)
491
+ if (argument->getType ().getASTType () == metaType &&
492
+ argument->getType ().isObject ())
492
493
return argument;
493
494
}
494
495
}
Original file line number Diff line number Diff line change @@ -371,3 +371,16 @@ bb0(%0 : $@thick SpecialEnum.Type):
371
371
%5 = struct $Bool (%4 : $Builtin.Int1)
372
372
return %5 : $Bool
373
373
}
374
+
375
+ // CHECK-LABEL: sil @dontSimplifyIndirectMetatype : $@convention(thin) () -> @out @thick Int.Type {
376
+ // CHECK: [[MT:%[0-9]+]] = metatype $@thick Int.Type
377
+ // CHECK: store [[MT]] to %0
378
+ // CHECK-LABEL: } // end sil function 'dontSimplifyIndirectMetatype'
379
+ sil @dontSimplifyIndirectMetatype : $@convention(thin) () -> @out @thick Int.Type {
380
+ bb0(%0 : $*@thick Int.Type):
381
+ %1 = metatype $@thick Int.Type
382
+ store %1 to %0 : $*@thick Int.Type
383
+ %3 = tuple ()
384
+ return %3 : $()
385
+ }
386
+
You can’t perform that action at this time.
0 commit comments