From e922c0201916e0b980ab3cfe91e1413e68d55647 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 22 Jul 2009 00:24:57 +0000 Subject: Get rid of the Pass+Context magic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/LowerSwitch.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Transforms/Utils/LowerSwitch.cpp') diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index 2a7124c..b412147 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"); } -- cgit v1.1