Use IRBuilder.

llvm-svn: 131609
This commit is contained in:
Devang Patel 2011-05-19 00:13:33 +00:00
parent 5dfe17d242
commit 3015a54813
1 changed files with 2 additions and 2 deletions

View File

@ -2404,8 +2404,8 @@ static bool TurnSwitchRangeIntoICmp(SwitchInst *SI, IRBuilder<> &Builder) {
Value *Sub = SI->getCondition(); Value *Sub = SI->getCondition();
if (!Offset->isNullValue()) if (!Offset->isNullValue())
Sub = BinaryOperator::CreateAdd(Sub, Offset, Sub->getName()+".off", SI); Sub = Builder.CreateAdd(Sub, Offset, Sub->getName()+".off");
Value *Cmp = new ICmpInst(SI, ICmpInst::ICMP_ULT, Sub, NumCases, "switch"); Value *Cmp = Builder.CreateICmpULT(Sub, NumCases, "switch");
Builder.CreateCondBr(Cmp, SI->getSuccessor(1), SI->getDefaultDest()); Builder.CreateCondBr(Cmp, SI->getSuccessor(1), SI->getDefaultDest());
// Prune obsolete incoming values off the successor's PHI nodes. // Prune obsolete incoming values off the successor's PHI nodes.