summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-05-21 10:44:40 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-05-21 10:44:40 +0000
commite89dafd876b18f64743a059fad91511d566fa1a4 (patch)
tree3eacf94cac1a57ee8bab61598965bd0f92303053 /llvm/lib/ExecutionEngine/Interpreter
parenta63d9531dd4e10df1d9530e8d2976e40e62a2e4a (diff)
downloadbcm5719-llvm-e89dafd876b18f64743a059fad91511d566fa1a4.tar.gz
bcm5719-llvm-e89dafd876b18f64743a059fad91511d566fa1a4.zip
PR1255 (case ranges: work with ConstantRangesSet instead of ConstantInt) related changes for Execution and Verifier.
llvm-svn: 157183
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index af47be9c5b5..298ce2c2b95 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -651,10 +651,16 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
// Check to see if any of the cases match...
BasicBlock *Dest = 0;
for (SwitchInst::CaseIt i = I.case_begin(), e = I.case_end(); i != e; ++i) {
- GenericValue CaseVal = getOperandValue(i.getCaseValue(), SF);
- if (executeICMP_EQ(CondVal, CaseVal, ElTy).IntVal != 0) {
- Dest = cast<BasicBlock>(i.getCaseSuccessor());
- break;
+ ConstantRangesSet Case = i.getCaseValueEx();
+ for (unsigned n = 0, en = Case.getNumItems(); n != en; ++n) {
+ ConstantRangesSet::Range r = Case.getItem(n);
+ GenericValue Low = getOperandValue(r.Low, SF);
+ GenericValue High = getOperandValue(r.High, SF);
+ if (executeICMP_ULE(Low, CondVal, ElTy).IntVal != 0 &&
+ executeICMP_ULE(CondVal, High, ElTy).IntVal != 0) {
+ Dest = cast<BasicBlock>(i.getCaseSuccessor());
+ break;
+ }
}
}
if (!Dest) Dest = I.getDefaultDest(); // No cases matched: use default
OpenPOWER on IntegriCloud