diff options
Diffstat (limited to 'lib/VMCore/Verifier.cpp')
-rw-r--r-- | lib/VMCore/Verifier.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 64b087631e..c546e416f4 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -805,15 +805,16 @@ void Verifier::visitSwitchInst(SwitchInst &SI) { // Check to make sure that all of the constants in the switch instruction // have the same type as the switched-on value. Type *SwitchTy = SI.getCondition()->getType(); + IntegerType *IntTy = cast<IntegerType>(SwitchTy); CRSBuilder Builder; std::map<ConstantRangesSet::Range, unsigned> RangeSetMap; for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end(); i != e; ++i) { ConstantRangesSet RS = i.getCaseValueEx(); for (unsigned ri = 0, rie = RS.getNumItems(); ri < rie; ++ri) { ConstantRangesSet::Range r = RS.getItem(ri); - Assert1(r.Low->getType() == SwitchTy, + Assert1(r.Low->getBitWidth() == IntTy->getBitWidth(), "Switch constants must all be same type as switch value!", &SI); - Assert1(r.High->getType() == SwitchTy, + Assert1(r.High->getBitWidth() == IntTy->getBitWidth(), "Switch constants must all be same type as switch value!", &SI); Builder.add(r); RangeSetMap[r] = i.getCaseIndex(); |