aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerSwitch.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-22 00:24:57 +0000
committerOwen Anderson <resistor@mac.com>2009-07-22 00:24:57 +0000
commite922c0201916e0b980ab3cfe91e1413e68d55647 (patch)
tree663be741b84470d97945f01da459a3627af683fd /lib/Transforms/Utils/LowerSwitch.cpp
parent7cf12c7efd37dc12c3ed536a3f4c373dddac2b85 (diff)
Get rid of the Pass+Context magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index 2a7124c9aa..b4121479db 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -162,7 +162,7 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End,
Function::iterator FI = OrigBlock;
F->getBasicBlockList().insert(++FI, NewNode);
- ICmpInst* Comp = new ICmpInst(*Default->getContext(), ICmpInst::ICMP_SLT,
+ ICmpInst* Comp = new ICmpInst(Default->getContext(), ICmpInst::ICMP_SLT,
Val, Pivot.Low, "Pivot");
NewNode->getInstList().push_back(Comp);
BranchInst::Create(LBranch, RBranch, Comp, NewNode);
@@ -180,6 +180,7 @@ BasicBlock* LowerSwitch::newLeafBlock(CaseRange& Leaf, Value* Val,
BasicBlock* Default)
{
Function* F = OrigBlock->getParent();
+ LLVMContext &Context = F->getContext();
BasicBlock* NewLeaf = BasicBlock::Create("LeafBlock");
Function::iterator FI = OrigBlock;
F->getBasicBlockList().insert(++FI, NewLeaf);
@@ -202,11 +203,11 @@ BasicBlock* LowerSwitch::newLeafBlock(CaseRange& Leaf, Value* Val,
"SwitchLeaf");
} else {
// Emit V-Lo <=u Hi-Lo
- Constant* NegLo = Context->getConstantExprNeg(Leaf.Low);
+ Constant* NegLo = Context.getConstantExprNeg(Leaf.Low);
Instruction* Add = BinaryOperator::CreateAdd(Val, NegLo,
Val->getName()+".off",
NewLeaf);
- Constant *UpperBound = Context->getConstantExprAdd(NegLo, Leaf.High);
+ Constant *UpperBound = Context.getConstantExprAdd(NegLo, Leaf.High);
Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Add, UpperBound,
"SwitchLeaf");
}