@@ -3688,41 +3688,6 @@ namespace {
36883688 return nullptr ;
36893689 }
36903690
3691- bool hasVisibleValueWitnessTable (CanType t) const {
3692- // Some builtin and structural types have value witnesses exported from
3693- // the runtime.
3694- auto &C = IGF.IGM .Context ;
3695- if (t == C.TheEmptyTupleType
3696- || t == C.TheNativeObjectType
3697- || t == C.TheBridgeObjectType
3698- || t == C.TheRawPointerType
3699- || t == C.getAnyObjectType ())
3700- return true ;
3701- if (auto intTy = dyn_cast<BuiltinIntegerType>(t)) {
3702- auto width = intTy->getWidth ();
3703- if (width.isPointerWidth ())
3704- return true ;
3705- if (width.isFixedWidth ()) {
3706- switch (width.getFixedWidth ()) {
3707- case 8 :
3708- case 16 :
3709- case 32 :
3710- case 64 :
3711- case 128 :
3712- case 256 :
3713- return true ;
3714- default :
3715- return false ;
3716- }
3717- }
3718- return false ;
3719- }
3720-
3721- // TODO: If a nominal type is in the same source file as we're currently
3722- // emitting, we would be able to see its value witness table.
3723- return false ;
3724- }
3725-
37263691 // / Fallback default implementation.
37273692 llvm::Value *visitType (CanType t, DynamicMetadataRequest request) {
37283693 auto silTy = IGF.IGM .getLoweredType (t);
@@ -3731,7 +3696,10 @@ namespace {
37313696 // If the type is in the same source file, or has a common value
37323697 // witness table exported from the runtime, we can project from the
37333698 // value witness table instead of emitting a new record.
3734- if (hasVisibleValueWitnessTable (t))
3699+ //
3700+ // TODO: If a nominal type is in the same source file as we're currently
3701+ // emitting, we would be able to see its value witness table.
3702+ if (IGF.IGM .IsWellKnownBuiltinOrStructralType (t))
37353703 return emitFromValueWitnessTable (t);
37363704
37373705 // If the type is a singleton aggregate, the field's layout is equivalent
0 commit comments