aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp11
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp6
-rw-r--r--lib/ExecutionEngine/Interpreter/Execution.cpp4
-rw-r--r--lib/Transforms/Utils/Local.cpp2
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp6
-rw-r--r--lib/VMCore/Verifier.cpp4
6 files changed, 16 insertions, 17 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 7dd18c87ff..6526b012d8 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1161,16 +1161,15 @@ static void WriteInstruction(const Instruction &I, unsigned InstID,
Vals64.push_back(CaseRanges.getNumItems());
for (unsigned ri = 0, rn = CaseRanges.getNumItems(); ri != rn; ++ri) {
IntegersSubset::Range r = CaseRanges.getItem(ri);
+ bool IsSingleNumber = r.isSingleNumber();
- Vals64.push_back(CaseRanges.isSingleNumber(ri));
+ Vals64.push_back(IsSingleNumber);
- const APInt &Low = r.Low;
- const APInt &High = r.High;
unsigned Code, Abbrev; // will unused.
- EmitAPInt(Vals64, Code, Abbrev, Low, true);
- if (r.Low != r.High)
- EmitAPInt(Vals64, Code, Abbrev, High, true);
+ EmitAPInt(Vals64, Code, Abbrev, r.getLow(), true);
+ if (!IsSingleNumber)
+ EmitAPInt(Vals64, Code, Abbrev, r.getHigh(), true);
}
Vals64.push_back(VE.getValueID(i.getCaseSuccessor()));
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 15c4258ddb..305d03a241 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2458,10 +2458,10 @@ size_t SelectionDAGBuilder::Clusterify(CaseVector& Cases,
// FIXME: Currently work with ConstantInt based numbers.
// Changing it to APInt based is a pretty heavy for this commit.
- Cases.push_back(Case(C.first.Low.toConstantInt(),
- C.first.High.toConstantInt(), C.second, W));
+ Cases.push_back(Case(C.first.getLow().toConstantInt(),
+ C.first.getHigh().toConstantInt(), C.second, W));
- if (C.first.Low != C.first.High)
+ if (C.first.getLow() != C.first.getHigh())
// A range counts double, since it requires two compares.
++numCmps;
}
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp
index d4b6ed0003..89c35438ef 100644
--- a/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -655,8 +655,8 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
for (unsigned n = 0, en = Case.getNumItems(); n != en; ++n) {
IntegersSubset::Range r = Case.getItem(n);
// FIXME: Currently work with ConstantInt based numbers.
- const ConstantInt *LowCI = r.Low.toConstantInt();
- const ConstantInt *HighCI = r.High.toConstantInt();
+ const ConstantInt *LowCI = r.getLow().toConstantInt();
+ const ConstantInt *HighCI = r.getHigh().toConstantInt();
GenericValue Low = getOperandValue(const_cast<ConstantInt*>(LowCI), SF);
GenericValue High = getOperandValue(const_cast<ConstantInt*>(HighCI), SF);
if (executeICMP_ULE(Low, CondVal, ElTy).IntVal != 0 &&
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;
}
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 4d33c623af..d9a535c9d8 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -813,9 +813,9 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
IntegersSubset CaseRanges = i.getCaseValueEx();
for (unsigned ri = 0, rie = CaseRanges.getNumItems(); ri < rie; ++ri) {
IntegersSubset::Range r = CaseRanges.getItem(ri);
- Assert1(((const APInt&)r.Low).getBitWidth() == IntTy->getBitWidth(),
+ Assert1(((const APInt&)r.getLow()).getBitWidth() == IntTy->getBitWidth(),
"Switch constants must all be same type as switch value!", &SI);
- Assert1(((const APInt&)r.High).getBitWidth() == IntTy->getBitWidth(),
+ Assert1(((const APInt&)r.getHigh()).getBitWidth() == IntTy->getBitWidth(),
"Switch constants must all be same type as switch value!", &SI);
Mapping.add(r);
RangeSetMap[r] = i.getCaseIndex();