summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/LowerSwitch.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-09 23:48:35 +0000
committerOwen Anderson <resistor@mac.com>2009-07-09 23:48:35 +0000
commit333c40096561218bc3597cf153c0a3895274414c (patch)
treebc6f5f739c43dec91104275aec30e16f30a7610e /lib/Transforms/Utils/LowerSwitch.cpp
parent53674361efd42f9dd7c4d293132106839ab3b893 (diff)
downloadllvm-333c40096561218bc3597cf153c0a3895274414c.tar.gz
llvm-333c40096561218bc3597cf153c0a3895274414c.tar.bz2
llvm-333c40096561218bc3597cf153c0a3895274414c.tar.xz
This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index ed6eca6c15..2a7124c9aa 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -162,7 +162,8 @@ BasicBlock* LowerSwitch::switchConvert(CaseItr Begin, CaseItr End,
Function::iterator FI = OrigBlock;
F->getBasicBlockList().insert(++FI, NewNode);
- ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_SLT, Val, Pivot.Low, "Pivot");
+ ICmpInst* Comp = new ICmpInst(*Default->getContext(), ICmpInst::ICMP_SLT,
+ Val, Pivot.Low, "Pivot");
NewNode->getInstList().push_back(Comp);
BranchInst::Create(LBranch, RBranch, Comp, NewNode);
return NewNode;
@@ -187,18 +188,18 @@ BasicBlock* LowerSwitch::newLeafBlock(CaseRange& Leaf, Value* Val,
ICmpInst* Comp = NULL;
if (Leaf.Low == Leaf.High) {
// Make the seteq instruction...
- Comp = new ICmpInst(ICmpInst::ICMP_EQ, Val, Leaf.Low,
- "SwitchLeaf", NewLeaf);
+ Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_EQ, Val,
+ Leaf.Low, "SwitchLeaf");
} else {
// Make range comparison
if (cast<ConstantInt>(Leaf.Low)->isMinValue(true /*isSigned*/)) {
// Val >= Min && Val <= Hi --> Val <= Hi
- Comp = new ICmpInst(ICmpInst::ICMP_SLE, Val, Leaf.High,
- "SwitchLeaf", NewLeaf);
+ Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_SLE, Val, Leaf.High,
+ "SwitchLeaf");
} else if (cast<ConstantInt>(Leaf.Low)->isZero()) {
// Val >= 0 && Val <= Hi --> Val <=u Hi
- Comp = new ICmpInst(ICmpInst::ICMP_ULE, Val, Leaf.High,
- "SwitchLeaf", NewLeaf);
+ Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Val, Leaf.High,
+ "SwitchLeaf");
} else {
// Emit V-Lo <=u Hi-Lo
Constant* NegLo = Context->getConstantExprNeg(Leaf.Low);
@@ -206,8 +207,8 @@ BasicBlock* LowerSwitch::newLeafBlock(CaseRange& Leaf, Value* Val,
Val->getName()+".off",
NewLeaf);
Constant *UpperBound = Context->getConstantExprAdd(NegLo, Leaf.High);
- Comp = new ICmpInst(ICmpInst::ICMP_ULE, Add, UpperBound,
- "SwitchLeaf", NewLeaf);
+ Comp = new ICmpInst(*NewLeaf, ICmpInst::ICMP_ULE, Add, UpperBound,
+ "SwitchLeaf");
}
}