Revert "[InstCombine] Fix visitSwitchInst to use right operand types for sub cstexpr"
[oota-llvm.git] / lib / Transforms / InstCombine / InstructionCombining.cpp
index fc965b879dfdc844f8eed12f02d9b8ab1ab35085..5eee15f648906cc4997e03a8aaf7ea002cf50063 100644 (file)
@@ -2115,10 +2115,8 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
         for (SwitchInst::CaseIt i = SI.case_begin(), e = SI.case_end();
              i != e; ++i) {
           ConstantInt* CaseVal = i.getCaseValue();
-          Constant *LHS = LeadingKnownZeros
-                              ? ConstantExpr::getZExt(CaseVal, Cond->getType())
-                              : ConstantExpr::getSExt(CaseVal, Cond->getType());
-          Constant* NewCaseVal = ConstantExpr::getSub(LHS, AddRHS);
+          Constant* NewCaseVal = ConstantExpr::getSub(cast<Constant>(CaseVal),
+                                                      AddRHS);
           assert(isa<ConstantInt>(NewCaseVal) &&
                  "Result of expression should be constant");
           i.setValue(cast<ConstantInt>(NewCaseVal));