Ordinary PR1255 patch: DifferenceEngine and CPPBackend adopted to the new SwitchInst...
authorStepan Dyatkovskiy <stpworld@narod.ru>
Sat, 19 May 2012 13:14:30 +0000 (13:14 +0000)
committerStepan Dyatkovskiy <stpworld@narod.ru>
Sat, 19 May 2012 13:14:30 +0000 (13:14 +0000)
llvm-svn: 157112

llvm/lib/Target/CppBackend/CPPBackend.cpp
llvm/tools/llvm-diff/DifferenceEngine.cpp

index 69f0ff8..9f95455 100644 (file)
@@ -1105,7 +1105,7 @@ void CppWriter::printInstruction(const Instruction *I,
     nl(Out);
     for (SwitchInst::ConstCaseIt i = SI->case_begin(), e = SI->case_end();
          i != e; ++i) {
-      const ConstantInt* CaseVal = i.getCaseValue();
+      const ConstantRangesSet CaseVal = i.getCaseValueEx();
       const BasicBlock *BB = i.getCaseSuccessor();
       Out << iName << "->addCase("
           << getOpName(CaseVal) << ", "
index a5a99f5..0e7815b 100644 (file)
@@ -318,15 +318,15 @@ class FunctionDifferenceEngine {
 
       bool Difference = false;
 
-      DenseMap<ConstantInt*,BasicBlock*> LCases;
+      DenseMap<Constant*, BasicBlock*> LCases;
       
       for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end();
            I != E; ++I)
-        LCases[I.getCaseValue()] = I.getCaseSuccessor();
+        LCases[I.getCaseValueEx()] = I.getCaseSuccessor();
         
       for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end();
            I != E; ++I) {
-        ConstantInt *CaseValue = I.getCaseValue();
+        ConstantRangesSet CaseValue = I.getCaseValueEx();
         BasicBlock *LCase = LCases[CaseValue];
         if (LCase) {
           if (TryUnify) tryUnify(LCase, I.getCaseSuccessor());
@@ -338,7 +338,7 @@ class FunctionDifferenceEngine {
         }
       }
       if (!Difference)
-        for (DenseMap<ConstantInt*,BasicBlock*>::iterator
+        for (DenseMap<Constant*, BasicBlock*>::iterator
                I = LCases.begin(), E = LCases.end(); I != E; ++I) {
           if (Complain)
             Engine.logf("left switch has extra case %l") << I->first;