@@ -871,17 +871,6 @@ static bool stripOwnership(SILFunction &func) {
871
871
return madeChange;
872
872
}
873
873
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
-
885
874
static void prepareSILFunctionForOptimization (ModuleDecl *, SILFunction *f) {
886
875
if (!f->hasOwnership ())
887
876
return ;
@@ -895,11 +884,7 @@ static void prepareSILFunctionForOptimization(ModuleDecl *, SILFunction *f) {
895
884
namespace {
896
885
897
886
struct OwnershipModelEliminator : SILFunctionTransform {
898
- bool skipTransparent;
899
- bool skipStdlibModule;
900
-
901
- OwnershipModelEliminator (bool skipTransparent, bool skipStdlibModule)
902
- : skipTransparent(skipTransparent), skipStdlibModule(skipStdlibModule) {}
887
+ OwnershipModelEliminator () {}
903
888
904
889
void run () override {
905
890
if (DumpBefore.size ()) {
@@ -909,20 +894,9 @@ struct OwnershipModelEliminator : SILFunctionTransform {
909
894
auto *f = getFunction ();
910
895
auto &mod = getFunction ()->getModule ();
911
896
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
-
918
897
if (!f->hasOwnership ())
919
898
return ;
920
899
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
-
926
900
// Verify here to make sure ownership is correct before we strip.
927
901
{
928
902
// Add a pretty stack trace entry to tell users who see a verification
@@ -950,37 +924,20 @@ struct OwnershipModelEliminator : SILFunctionTransform {
950
924
invalidateAnalysis (InvalidKind);
951
925
}
952
926
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.
956
928
using NotificationHandlerTy =
957
929
FunctionBodyDeserializationNotificationHandler;
958
930
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 ();
972
935
}
973
936
}
974
937
};
975
938
976
939
} // end anonymous namespace
977
940
978
941
SILTransform *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 ();
986
943
}
0 commit comments