Skip to content

Commit 8044e33

Browse files
authored
Merge pull request #4638 from trentxintong/wireup-FSO
Replace SmallVector with SmallSetVector in the new epilogue ARC matcher
2 parents 1487d59 + 9b338e7 commit 8044e33

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

include/swift/SILOptimizer/Analysis/ARCAnalysis.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class EpilogueARCContext {
447447
RCIdentityFunctionInfo *RCFI;
448448

449449
/// The epilogue retains or releases.
450-
llvm::SmallVector<SILInstruction *, 1> EpilogueARCInsts;
450+
llvm::SmallSetVector<SILInstruction *, 1> EpilogueARCInsts;
451451

452452
/// All the retain/release block state for all the basic blocks in the function.
453453
llvm::DenseMap<SILBasicBlock *, EpilogueARCBlockState *> EpilogueARCBlockStates;
@@ -507,7 +507,7 @@ class EpilogueARCContext {
507507

508508
/// Reset the epilogue arc instructions.
509509
void resetEpilogueARCInsts() { EpilogueARCInsts.clear(); }
510-
llvm::SmallVector<SILInstruction *, 1> getEpilogueARCInsts() {
510+
llvm::SmallSetVector<SILInstruction *, 1> getEpilogueARCInsts() {
511511
return EpilogueARCInsts;
512512
}
513513

@@ -577,7 +577,7 @@ class EpilogueARCContext {
577577
/// empty set if no epilogue ARC instructions can be found.
578578
///
579579
/// NOTE: This function assumes Arg is has @owned semantic.
580-
llvm::SmallVector<SILInstruction *, 1>
580+
llvm::SmallSetVector<SILInstruction *, 1>
581581
computeEpilogueARCInstructions(EpilogueARCContext::EpilogueARCKind Kind,
582582
SILValue Arg, SILFunction *F,
583583
PostOrderFunctionInfo *PO, AliasAnalysis *AA,

include/swift/SILOptimizer/Utils/FunctionSignatureOptUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct ResultDescriptor {
137137
/// If non-null, this is the release in the return block of the callee, which
138138
/// is associated with this parameter if it is @owned. If the parameter is not
139139
/// @owned or we could not find such a release in the callee, this is null.
140-
RetainList CalleeRetain;
140+
llvm::SmallSetVector<SILInstruction *, 1> CalleeRetain;
141141

142142
/// This is owned to guaranteed.
143143
bool OwnedToGuaranteed;

lib/SILOptimizer/Analysis/ARCAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ bool EpilogueARCContext::computeEpilogueARC() {
13011301
for (auto I = B->rbegin(), E = B->rend(); I != E; ++I) {
13021302
// This is a transition from 1 to 0 due to an interested instruction.
13031303
if (isInterestedInstruction(&*I)) {
1304-
EpilogueARCInsts.push_back(&*I);
1304+
EpilogueARCInsts.insert(&*I);
13051305
break;
13061306
}
13071307
// This is a transition from 1 to 0 due to a blocking instruction.
@@ -1313,7 +1313,7 @@ bool EpilogueARCContext::computeEpilogueARC() {
13131313
return true;
13141314
}
13151315

1316-
llvm::SmallVector<SILInstruction *, 1>
1316+
llvm::SmallSetVector<SILInstruction *, 1>
13171317
swift::computeEpilogueARCInstructions(EpilogueARCContext::EpilogueARCKind Kind,
13181318
SILValue Arg, SILFunction *F,
13191319
PostOrderFunctionInfo *PO, AliasAnalysis *AA,

lib/SILOptimizer/UtilityPasses/EpilogueARCMatcherDumper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ class SILEpilogueARCMatcherDumper : public SILModuleTransform {
5252
llvm::outs() << *Arg;
5353

5454
// Find the retain instructions for the argument.
55-
llvm::SmallVector<SILInstruction *, 1> RelInsts =
55+
llvm::SmallSetVector<SILInstruction *, 1> RelInsts =
5656
computeEpilogueARCInstructions(EpilogueARCContext::EpilogueARCKind::Release,
5757
Arg, &F, PO, AA, RCFI);
5858
for (auto I : RelInsts) {
5959
llvm::outs() << *I << "\n";
6060
}
6161

6262
// Find the release instructions for the argument.
63-
llvm::SmallVector<SILInstruction *, 1> RetInsts =
63+
llvm::SmallSetVector<SILInstruction *, 1> RetInsts =
6464
computeEpilogueARCInstructions(EpilogueARCContext::EpilogueARCKind::Retain,
6565
Arg, &F, PO, AA, RCFI);
6666
for (auto I : RetInsts) {

0 commit comments

Comments
 (0)