Skip to content

Commit 0e068ea

Browse files
committed
Add some comments and remove dead while-loop.
Thanks @atrick for reviewing!
1 parent d93167f commit 0e068ea

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

include/swift/SILOptimizer/Analysis/BasicCalleeAnalysis.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,23 @@ class BasicCalleeAnalysis : public SILAnalysis {
138138
}
139139

140140
/// Invalidate all of the information for a specific function.
141-
virtual void invalidate(SILFunction *F, InvalidationKind K) override { }
141+
virtual void invalidate(SILFunction *F, InvalidationKind K) override {
142+
// No invalidation needed because the analysis does not cache anything
143+
// per call-site in functions.
144+
}
142145

143146
/// Notify the analysis about a newly created function.
144-
virtual void notifyAddFunction(SILFunction *F) override { }
147+
virtual void notifyAddFunction(SILFunction *F) override {
148+
// Nothing to be done because the analysis does not cache anything
149+
// per call-site in functions.
150+
}
145151

146152
/// Notify the analysis about a function which will be deleted from the
147153
/// module.
148-
virtual void notifyDeleteFunction(SILFunction *F) override { };
154+
virtual void notifyDeleteFunction(SILFunction *F) override {
155+
// No invalidation needed because the analysis does not cache anything
156+
// per call-site in functions.
157+
};
149158

150159
/// Notify the analysis about changed witness or vtables.
151160
virtual void invalidateFunctionTables() override {

include/swift/SILOptimizer/Analysis/DestructorAnalysis.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ class DestructorAnalysis : public SILAnalysis {
3535
bool mayStoreToMemoryOnDestruction(SILType T);
3636

3737
/// No invalidation is needed.
38-
virtual void invalidate() override { }
38+
virtual void invalidate() override {
39+
// Nothing can invalidate, because types are static and cannot be changed
40+
// during the SIL pass pipeline.
41+
}
3942

4043
/// No invalidation is needed.
41-
virtual void invalidate(SILFunction *F, InvalidationKind K) override { }
44+
virtual void invalidate(SILFunction *F, InvalidationKind K) override {
45+
// Nothing can invalidate, because types are static and cannot be changed
46+
// during the SIL pass pipeline.
47+
}
4248

4349
/// Notify the analysis about a newly created function.
4450
virtual void notifyAddFunction(SILFunction *F) override { }

lib/SILOptimizer/IPO/CapturePromotion.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,6 @@ class CapturePromotionPass : public SILModuleTransform {
970970
for (auto &F : *getModule())
971971
processFunction(&F, Worklist);
972972

973-
if (!Worklist.empty()) {
974-
}
975-
976973
while (!Worklist.empty())
977974
processFunction(Worklist.pop_back_val(), Worklist);
978975
}

0 commit comments

Comments
 (0)