summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit47db941fd3e5a698c4417e38686ff6da6b2d81ee (patch)
treef1bc8ce05f4b4c0c6f5eb775c3e5b12eda35e2f1 /llvm/lib/Transforms/Utils/LowerSwitch.cpp
parent4565ef5b65b7d0b778b41836d70b806196cc8e24 (diff)
downloadbcm5719-llvm-47db941fd3e5a698c4417e38686ff6da6b2d81ee.tar.gz
bcm5719-llvm-47db941fd3e5a698c4417e38686ff6da6b2d81ee.zip
Get rid of the Pass+Context magic.
llvm-svn: 76702
Diffstat (limited to 'llvm/lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LowerSwitch.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/llvm/lib/Transforms/Utils/LowerSwitch.cpp
index 2a7124c9aa0..b4121479dba 100644
--- a/llvm/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/llvm/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");
}
OpenPOWER on IntegriCloud