@@ -871,17 +871,6 @@ static bool stripOwnership(SILFunction &func) {
871871 return madeChange;
872872}
873873
874- static void prepareNonTransparentSILFunctionForOptimization (ModuleDecl *,
875- SILFunction *f) {
876- if (!f->hasOwnership () || f->isTransparent ())
877- return ;
878-
879- LLVM_DEBUG (llvm::dbgs () << " After deserialization, stripping ownership in:"
880- << f->getName () << " \n " );
881-
882- stripOwnership (*f);
883- }
884-
885874static void prepareSILFunctionForOptimization (ModuleDecl *, SILFunction *f) {
886875 if (!f->hasOwnership ())
887876 return ;
@@ -895,11 +884,7 @@ static void prepareSILFunctionForOptimization(ModuleDecl *, SILFunction *f) {
895884namespace {
896885
897886struct OwnershipModelEliminator : SILFunctionTransform {
898- bool skipTransparent;
899- bool skipStdlibModule;
900-
901- OwnershipModelEliminator (bool skipTransparent, bool skipStdlibModule)
902- : skipTransparent(skipTransparent), skipStdlibModule(skipStdlibModule) {}
887+ OwnershipModelEliminator () {}
903888
904889 void run () override {
905890 if (DumpBefore.size ()) {
@@ -909,20 +894,9 @@ struct OwnershipModelEliminator : SILFunctionTransform {
909894 auto *f = getFunction ();
910895 auto &mod = getFunction ()->getModule ();
911896
912- // If we are supposed to skip the stdlib module and we are in the stdlib
913- // module bail.
914- if (skipStdlibModule && mod.isStdlibModule ()) {
915- return ;
916- }
917-
918897 if (!f->hasOwnership ())
919898 return ;
920899
921- // If we were asked to not strip ownership from transparent functions in
922- // /our/ module, return.
923- if (skipTransparent && f->isTransparent ())
924- return ;
925-
926900 // Verify here to make sure ownership is correct before we strip.
927901 {
928902 // Add a pretty stack trace entry to tell users who see a verification
@@ -950,37 +924,20 @@ struct OwnershipModelEliminator : SILFunctionTransform {
950924 invalidateAnalysis (InvalidKind);
951925 }
952926
953- // If we were asked to strip transparent, we are at the beginning of the
954- // performance pipeline. In such a case, we register a handler so that all
955- // future things we deserialize have ownership stripped.
927+ // Register a handler so that all future things we deserialize have ownership stripped.
956928 using NotificationHandlerTy =
957929 FunctionBodyDeserializationNotificationHandler;
958930 std::unique_ptr<DeserializationNotificationHandler> ptr;
959- if (skipTransparent) {
960- if (!mod.hasRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME ()) {
961- ptr.reset (new NotificationHandlerTy (
962- prepareNonTransparentSILFunctionForOptimization));
963- mod.registerDeserializationNotificationHandler (std::move (ptr));
964- mod.setRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME ();
965- }
966- } else {
967- if (!mod.hasRegisteredDeserializationNotificationHandlerForAllFuncOME ()) {
968- ptr.reset (new NotificationHandlerTy (prepareSILFunctionForOptimization));
969- mod.registerDeserializationNotificationHandler (std::move (ptr));
970- mod.setRegisteredDeserializationNotificationHandlerForAllFuncOME ();
971- }
931+ if (!mod.hasRegisteredDeserializationNotificationHandlerForAllFuncOME ()) {
932+ ptr.reset (new NotificationHandlerTy (prepareSILFunctionForOptimization));
933+ mod.registerDeserializationNotificationHandler (std::move (ptr));
934+ mod.setRegisteredDeserializationNotificationHandlerForAllFuncOME ();
972935 }
973936 }
974937};
975938
976939} // end anonymous namespace
977940
978941SILTransform *swift::createOwnershipModelEliminator () {
979- return new OwnershipModelEliminator (false /* skip transparent*/ ,
980- false /* ignore stdlib*/ );
981- }
982-
983- SILTransform *swift::createNonTransparentFunctionOwnershipModelEliminator () {
984- return new OwnershipModelEliminator (true /* skip transparent*/ ,
985- false /* ignore stdlib*/ );
942+ return new OwnershipModelEliminator ();
986943}
0 commit comments