forked from OSchip/llvm-project
parent
5dfe17d242
commit
3015a54813
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue