From 43eb31bfae470b33bab9a6764b98b5e8a0beeda5 Mon Sep 17 00:00:00 2001 From: Stepan Dyatkovskiy Date: Sat, 2 Jun 2012 09:42:43 +0000 Subject: PR1255: case ranges. IntRange converted from struct to class. So main change everywhere is replacement of ".Low/High" with ".getLow/getHigh()" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157884 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/Local.cpp | 2 +- lib/Transforms/Utils/LowerSwitch.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Transforms') diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index a4ddfa5de3..3c6793f3ad 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -173,7 +173,7 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool DeleteDeadConditions) { if (CaseRanges.getNumItems() == 1 && CaseRanges.isSingleNumber(0)) { // FIXME: Currently work with ConstantInt based numbers. Value *Cond = Builder.CreateICmpEQ(SI->getCondition(), - CaseRanges.getItem(0).Low.toConstantInt(), + CaseRanges.getItem(0).getLow().toConstantInt(), "cond"); // Insert the new branch. diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp index a4cf773292..1547439b5c 100644 --- a/lib/Transforms/Utils/LowerSwitch.cpp +++ b/lib/Transforms/Utils/LowerSwitch.cpp @@ -242,9 +242,9 @@ unsigned LowerSwitch::Clusterify(CaseVector& Cases, SwitchInst *SI) { // FIXME: Currently work with ConstantInt based numbers. // Changing it to APInt based is a pretty heavy for this commit. - Cases.push_back(CaseRange(C.first.Low.toConstantInt(), - C.first.High.toConstantInt(), C.second)); - if (C.first.Low != C.first.High) + Cases.push_back(CaseRange(C.first.getLow().toConstantInt(), + C.first.getHigh().toConstantInt(), C.second)); + if (C.first.isSingleNumber()) // A range counts double, since it requires two compares. ++numCmps; } -- cgit v1.2.3-70-g09d2