Skip to content

Commit 11abefe

Browse files
committed
[NFC] SILCombine: Use DeadEndBlocksAnalysis.
Instead of having a separately calculated version.
1 parent b5e4fcf commit 11abefe

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/SILOptimizer/SILCombiner/SILCombine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ SILCombiner::SILCombiner(SILFunctionTransform *trans,
192192
use->set(newValue);
193193
Worklist.add(use->getUser());
194194
})),
195-
deadEndBlocks(trans->getFunction()), MadeChange(false),
196-
RemoveCondFails(removeCondFails),
195+
DEBA(trans->getPassManager()->getAnalysis<DeadEndBlocksAnalysis>()),
196+
MadeChange(false), RemoveCondFails(removeCondFails),
197197
enableCopyPropagation(enableCopyPropagation), Iteration(0),
198198
Builder(*trans->getFunction(), &TrackingList),
199199
FuncBuilder(*trans),
@@ -354,7 +354,7 @@ void SILCombiner::canonicalizeOSSALifetimes(SILInstruction *currentInst) {
354354
CanonicalizeOSSALifetime canonicalizer(
355355
DontPruneDebugInsts,
356356
MaximizeLifetime_t(!parentTransform->getFunction()->shouldOptimize()),
357-
parentTransform->getFunction(), NLABA, domTree, CA, deleter);
357+
parentTransform->getFunction(), NLABA, DEBA, domTree, CA, deleter);
358358
CanonicalizeBorrowScope borrowCanonicalizer(parentTransform->getFunction(),
359359
deleter);
360360

@@ -397,7 +397,7 @@ bool SILCombiner::doOneIteration(SILFunction &F, unsigned Iteration) {
397397
// Add reachable instructions to our worklist.
398398
addReachableCodeToWorklist(&*F.begin());
399399

400-
SILCombineCanonicalize scCanonicalize(Worklist, deadEndBlocks);
400+
SILCombineCanonicalize scCanonicalize(Worklist, *DEBA->get(&F));
401401

402402
// Process until we run out of items in our worklist.
403403
while (!Worklist.isEmpty()) {

lib/SILOptimizer/SILCombiner/SILCombiner.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "swift/SIL/SILVisitor.h"
3232
#include "swift/SILOptimizer/Analysis/BasicCalleeAnalysis.h"
3333
#include "swift/SILOptimizer/Analysis/ClassHierarchyAnalysis.h"
34+
#include "swift/SILOptimizer/Analysis/DeadEndBlocksAnalysis.h"
3435
#include "swift/SILOptimizer/Analysis/NonLocalAccessBlockAnalysis.h"
3536
#include "swift/SILOptimizer/Analysis/ProtocolConformanceAnalysis.h"
3637
#include "swift/SILOptimizer/OptimizerBridging.h"
@@ -83,7 +84,7 @@ class SILCombiner :
8384
/// A cache of "dead end blocks" through which all paths it is known that the
8485
/// program will terminate. This means that we are allowed to leak
8586
/// objects.
86-
DeadEndBlocks deadEndBlocks;
87+
DeadEndBlocksAnalysis *DEBA;
8788

8889
/// Variable to track if the SILCombiner made any changes.
8990
bool MadeChange;

0 commit comments

Comments
 (0)