File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
lib/SILOptimizer/LoopTransforms Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ class COWArrayOpt {
105
105
RCIdentityFunctionInfo *RCIA;
106
106
SILFunction *Function;
107
107
SILLoop *Loop;
108
+ Optional<SmallVector<SILBasicBlock *, 8 >> LoopExitingBlocks;
108
109
SILBasicBlock *Preheader;
109
110
DominanceInfo *DomTree;
110
111
bool HasChanged = false ;
@@ -195,6 +196,16 @@ class COWArrayOpt {
195
196
return inst->getOperand (0 );
196
197
return cast<SingleValueInstruction>(inst);
197
198
}
199
+
200
+ ArrayRef<SILBasicBlock *> getLoopExitingBlocks () const {
201
+ if (!LoopExitingBlocks) {
202
+ auto *self = const_cast <COWArrayOpt *>(this );
203
+ self->LoopExitingBlocks .emplace ();
204
+ Loop->getExitingBlocks (*self->LoopExitingBlocks );
205
+ }
206
+ return *LoopExitingBlocks;
207
+ }
208
+
198
209
};
199
210
} // end anonymous namespace
200
211
@@ -990,9 +1001,7 @@ bool COWArrayOpt::hoistMakeMutable(ArraySemanticsCall MakeMutable,
990
1001
}
991
1002
992
1003
bool COWArrayOpt::dominatesExitingBlocks (SILBasicBlock *BB) {
993
- llvm::SmallVector<SILBasicBlock *, 8 > ExitingBlocks;
994
- Loop->getExitingBlocks (ExitingBlocks);
995
- for (SILBasicBlock *Exiting : ExitingBlocks) {
1004
+ for (SILBasicBlock *Exiting : getLoopExitingBlocks ()) {
996
1005
if (!DomTree->dominates (BB, Exiting))
997
1006
return false ;
998
1007
}
You can’t perform that action at this time.
0 commit comments