Skip to content

Commit 31cd6f9

Browse files
committed
IRGen: move FailBBs from IRGenSILFunction to its base class IRGenFunction
NFC
1 parent 5830079 commit 31cd6f9

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

lib/IRGen/IRGenFunction.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ IRGenFunction::IRGenFunction(IRGenModule &IGM, llvm::Function *Fn,
6363
}
6464

6565
IRGenFunction::~IRGenFunction() {
66+
// Move the trap basic blocks to the end of the function.
67+
for (auto *FailBB : FailBBs) {
68+
CurFn->splice(CurFn->end(), CurFn, FailBB->getIterator());
69+
}
70+
6671
emitEpilogue();
6772

6873
// Restore the debug location.

lib/IRGen/IRGenFunction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class IRGenFunction {
7878
OptimizationMode OptMode;
7979
bool isPerformanceConstraint;
8080

81+
// Destination basic blocks for condfail traps.
82+
llvm::SmallVector<llvm::BasicBlock *, 8> FailBBs;
83+
8184
llvm::Function *const CurFn;
8285
ModuleDecl *getSwiftModule() const;
8386
SILModule &getSILModule() const;

lib/IRGen/IRGenSIL.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,6 @@ class IRGenSILFunction :
420420

421421
llvm::MapVector<SILBasicBlock *, LoweredBB> LoweredBBs;
422422

423-
// Destination basic blocks for condfail traps.
424-
llvm::SmallVector<llvm::BasicBlock *, 8> FailBBs;
425-
426423
SILFunction *CurSILFn;
427424
// If valid, the address by means of which a return--which is direct in
428425
// SIL--is passed indirectly in IR. Such indirection is necessary when the
@@ -1190,15 +1187,6 @@ class IRGenSILFunction :
11901187
ArtificialKind::RealValue, DbgInstrKind);
11911188
}
11921189

1193-
void emitFailBB() {
1194-
if (!FailBBs.empty()) {
1195-
// Move the trap basic blocks to the end of the function.
1196-
for (auto *FailBB : FailBBs) {
1197-
CurFn->splice(CurFn->end(), CurFn, FailBB->getIterator());
1198-
}
1199-
}
1200-
}
1201-
12021190
//===--------------------------------------------------------------------===//
12031191
// SIL instruction lowering
12041192
//===--------------------------------------------------------------------===//
@@ -1966,9 +1954,6 @@ IRGenSILFunction::IRGenSILFunction(IRGenModule &IGM, SILFunction *f)
19661954

19671955
IRGenSILFunction::~IRGenSILFunction() {
19681956
assert(Builder.hasPostTerminatorIP() && "did not terminate BB?!");
1969-
// Emit the fail BB if we have one.
1970-
if (!FailBBs.empty())
1971-
emitFailBB();
19721957
LLVM_DEBUG(CurFn->print(llvm::dbgs()));
19731958
}
19741959

0 commit comments

Comments
 (0)