|
31 | 31 |
|
32 | 32 | using namespace llvm;
|
33 | 33 |
|
| 34 | +using BlockSet = SetVector<BasicBlock *>; |
| 35 | + |
34 | 36 | /// Replaces BB Terminator with one that only contains Chunk BBs
|
35 | 37 | static void replaceBranchTerminator(BasicBlock &BB,
|
36 |
| - const DenseSet<BasicBlock *> &BBsToDelete) { |
| 38 | + const BlockSet &BBsToDelete) { |
37 | 39 | auto *Term = BB.getTerminator();
|
38 | 40 | std::vector<BasicBlock *> ChunkSuccessors;
|
39 | 41 | for (auto *Succ : successors(&BB)) {
|
@@ -104,9 +106,8 @@ static void replaceBranchTerminator(BasicBlock &BB,
|
104 | 106 | /// Removes uninteresting BBs from switch, if the default case ends up being
|
105 | 107 | /// uninteresting, the switch is replaced with a void return (since it has to be
|
106 | 108 | /// replace with something)
|
107 |
| -static void |
108 |
| -removeUninterestingBBsFromSwitch(SwitchInst &SwInst, |
109 |
| - const DenseSet<BasicBlock *> &BBsToDelete) { |
| 109 | +static void removeUninterestingBBsFromSwitch(SwitchInst &SwInst, |
| 110 | + const BlockSet &BBsToDelete) { |
110 | 111 | for (int I = 0, E = SwInst.getNumCases(); I != E; ++I) {
|
111 | 112 | auto Case = SwInst.case_begin() + I;
|
112 | 113 | if (BBsToDelete.count(Case->getCaseSuccessor())) {
|
@@ -142,7 +143,8 @@ removeUninterestingBBsFromSwitch(SwitchInst &SwInst,
|
142 | 143 | /// Removes out-of-chunk arguments from functions, and modifies their calls
|
143 | 144 | /// accordingly. It also removes allocations of out-of-chunk arguments.
|
144 | 145 | void llvm::reduceBasicBlocksDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
|
145 |
| - DenseSet<BasicBlock *> BBsToDelete; |
| 146 | + BlockSet BBsToDelete; |
| 147 | + |
146 | 148 | df_iterator_default_set<BasicBlock *> Reachable;
|
147 | 149 |
|
148 | 150 | for (auto &F : WorkItem.getModule()) {
|
@@ -183,7 +185,8 @@ void llvm::reduceBasicBlocksDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
|
183 | 185 | // Cleanup any blocks that are now dead after eliminating this set. This
|
184 | 186 | // will likely be larger than the number of blocks the oracle told us to
|
185 | 187 | // delete.
|
186 |
| - EliminateUnreachableBlocks(F); |
| 188 | + simpleSimplifyCFG(F, BBsToDelete.getArrayRef()); |
| 189 | + |
187 | 190 | BBsToDelete.clear();
|
188 | 191 | }
|
189 | 192 | }
|
|
0 commit comments