diff --git a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp index ecb26a839c2..0ddcc1e088c 100644 --- a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp +++ b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp @@ -519,23 +519,10 @@ class ElementUseCollector { const DIMemoryObjectInfo &TheMemory; DIElementUseInfo &UseInfo; - /// This is true if definite initialization has finished processing assign - /// and other ambiguous instructions into init vs assign classes. - bool isDefiniteInitFinished; - /// IsSelfOfNonDelegatingInitializer - This is true if we're looking at the /// top level of a 'self' variable in a non-delegating init method. bool IsSelfOfNonDelegatingInitializer; - /// How should address_to_pointer be handled? - /// - /// In DefiniteInitialization it is considered as an inout parameter to get - /// diagnostics about passing a let variable to an inout mutable-pointer - /// argument. - /// In PredictableMemOpt it is considered as an escape point to be - /// conservative. - bool TreatAddressToPointerAsInout; - /// When walking the use list, if we index into a struct element, keep track /// of this, so that any indexes into tuple subelements don't affect the /// element we attribute an access to. @@ -547,11 +534,9 @@ class ElementUseCollector { public: ElementUseCollector(const DIMemoryObjectInfo &TheMemory, - DIElementUseInfo &UseInfo, bool isDefiniteInitFinished, - bool TreatAddressToPointerAsInout) + DIElementUseInfo &UseInfo) : Module(TheMemory.MemoryInst->getModule()), TheMemory(TheMemory), - UseInfo(UseInfo), isDefiniteInitFinished(isDefiniteInitFinished), - TreatAddressToPointerAsInout(TreatAddressToPointerAsInout) {} + UseInfo(UseInfo) {} /// This is the main entry point for the use walker. It collects uses from /// the address and the refcount result of the allocation. @@ -775,8 +760,6 @@ void ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) { Kind = DIUseKind::PartialStore; \ else if (SWI->isInitializationOfDest()) \ Kind = DIUseKind::Initialization; \ - else if (isDefiniteInitFinished) \ - Kind = DIUseKind::Assign; \ else \ Kind = DIUseKind::InitOrAssign; \ trackUse(DIMemoryUse(User, Kind, BaseEltNo, 1)); \ @@ -803,8 +786,6 @@ void ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) { Kind = DIUseKind::PartialStore; else if (CAI->isInitializationOfDest()) Kind = DIUseKind::Initialization; - else if (isDefiniteInitFinished) - Kind = DIUseKind::Assign; else Kind = DIUseKind::InitOrAssign; @@ -900,7 +881,7 @@ void ElementUseCollector::collectUses(SILValue Pointer, unsigned BaseEltNo) { llvm_unreachable("bad parameter convention"); } - if (isa(User) && TreatAddressToPointerAsInout) { + if (isa(User)) { // address_to_pointer is a mutable escape, which we model as an inout use. addElementUses(BaseEltNo, PointeeType, User, DIUseKind::InOutArgument); @@ -1830,12 +1811,11 @@ static bool shouldPerformClassInitSelf(const DIMemoryObjectInfo &MemoryInfo) { MemoryInfo.isDerivedClassSelfOnly(); } -/// collectDIElementUsesFrom - Analyze all uses of the specified allocation -/// instruction (alloc_box, alloc_stack or mark_uninitialized), classifying them -/// and storing the information found into the Uses and Releases lists. +/// Analyze all uses of the specified allocation instruction (alloc_box, +/// alloc_stack or mark_uninitialized), classifying them and storing the +/// information found into the Uses and Releases lists. void swift::ownership::collectDIElementUsesFrom( - const DIMemoryObjectInfo &MemoryInfo, DIElementUseInfo &UseInfo, - bool isDIFinished, bool TreatAddressToPointerAsInout) { + const DIMemoryObjectInfo &MemoryInfo, DIElementUseInfo &UseInfo) { if (shouldPerformClassInitSelf(MemoryInfo)) { ClassInitElementUseCollector UseCollector(MemoryInfo, UseInfo); @@ -1852,7 +1832,5 @@ void swift::ownership::collectDIElementUsesFrom( return; } - ElementUseCollector(MemoryInfo, UseInfo, isDIFinished, - TreatAddressToPointerAsInout) - .collectFrom(); + ElementUseCollector(MemoryInfo, UseInfo).collectFrom(); } diff --git a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.h b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.h index 01081dbaa82..d53750369e0 100644 --- a/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.h +++ b/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.h @@ -306,9 +306,7 @@ struct DIElementUseInfo { /// instruction (alloc_box, alloc_stack or mark_uninitialized), classifying them /// and storing the information found into the Uses and Releases lists. void collectDIElementUsesFrom(const DIMemoryObjectInfo &MemoryInfo, - DIElementUseInfo &UseInfo, - bool isDefiniteInitFinished, - bool TreatAddressToPointerAsInout); + DIElementUseInfo &UseInfo); } // end namespace ownership } // end namespace swift diff --git a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp index f38626d68a8..a6c68b6e857 100644 --- a/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp +++ b/lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp @@ -2888,8 +2888,7 @@ static void processMemoryObject(MarkUninitializedInst *I) { DIElementUseInfo UseInfo; // Walk the use list of the pointer, collecting them into the Uses array. - collectDIElementUsesFrom(MemInfo, UseInfo, false, - /*TreatAddressToPointerAsInout*/ true); + collectDIElementUsesFrom(MemInfo, UseInfo); LifetimeChecker(MemInfo, UseInfo).doIt(); }