26
26
#include " llvm/Transforms/Utils/Local.h"
27
27
#include " llvm/Constants.h"
28
28
#include " llvm/Instructions.h"
29
- #include " llvm/LLVMContext.h"
30
29
#include " llvm/Module.h"
31
30
#include " llvm/Attributes.h"
32
31
#include " llvm/Support/CFG.h"
@@ -57,7 +56,7 @@ FunctionPass *llvm::createCFGSimplificationPass() {
57
56
58
57
// / ChangeToUnreachable - Insert an unreachable instruction before the specified
59
58
// / instruction, making it and the rest of the code in the block dead.
60
- static void ChangeToUnreachable (Instruction *I, LLVMContext &Context ) {
59
+ static void ChangeToUnreachable (Instruction *I) {
61
60
BasicBlock *BB = I->getParent ();
62
61
// Loop over all of the successors, removing BB's entry from any PHI
63
62
// nodes.
@@ -95,8 +94,7 @@ static void ChangeToCall(InvokeInst *II) {
95
94
}
96
95
97
96
static bool MarkAliveBlocks (BasicBlock *BB,
98
- SmallPtrSet<BasicBlock*, 128 > &Reachable,
99
- LLVMContext &Context) {
97
+ SmallPtrSet<BasicBlock*, 128 > &Reachable) {
100
98
101
99
SmallVector<BasicBlock*, 128 > Worklist;
102
100
Worklist.push_back (BB);
@@ -119,7 +117,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
119
117
// though.
120
118
++BBI;
121
119
if (!isa<UnreachableInst>(BBI)) {
122
- ChangeToUnreachable (BBI, Context );
120
+ ChangeToUnreachable (BBI);
123
121
Changed = true ;
124
122
}
125
123
break ;
@@ -135,7 +133,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
135
133
if (isa<UndefValue>(Ptr) ||
136
134
(isa<ConstantPointerNull>(Ptr) &&
137
135
SI->getPointerAddressSpace () == 0 )) {
138
- ChangeToUnreachable (SI, Context );
136
+ ChangeToUnreachable (SI);
139
137
Changed = true ;
140
138
break ;
141
139
}
@@ -161,7 +159,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
161
159
// / otherwise.
162
160
static bool RemoveUnreachableBlocksFromFn (Function &F) {
163
161
SmallPtrSet<BasicBlock*, 128 > Reachable;
164
- bool Changed = MarkAliveBlocks (F.begin (), Reachable, F. getContext () );
162
+ bool Changed = MarkAliveBlocks (F.begin (), Reachable);
165
163
166
164
// If there are unreachable blocks in the CFG...
167
165
if (Reachable.size () == F.size ())
0 commit comments