Ordinary PR1255 patch: DifferenceEngine and CPPBackend adopted to the new SwitchInst methods.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157112 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stepan Dyatkovskiy 2012-05-19 13:14:30 +00:00
parent 769237bb92
commit f4c261b137
2 changed files with 5 additions and 5 deletions

View File

@ -1105,7 +1105,7 @@ void CppWriter::printInstruction(const Instruction *I,
nl(Out); nl(Out);
for (SwitchInst::ConstCaseIt i = SI->case_begin(), e = SI->case_end(); for (SwitchInst::ConstCaseIt i = SI->case_begin(), e = SI->case_end();
i != e; ++i) { i != e; ++i) {
const ConstantInt* CaseVal = i.getCaseValue(); const ConstantRangesSet CaseVal = i.getCaseValueEx();
const BasicBlock *BB = i.getCaseSuccessor(); const BasicBlock *BB = i.getCaseSuccessor();
Out << iName << "->addCase(" Out << iName << "->addCase("
<< getOpName(CaseVal) << ", " << getOpName(CaseVal) << ", "

View File

@ -318,15 +318,15 @@ class FunctionDifferenceEngine {
bool Difference = false; bool Difference = false;
DenseMap<ConstantInt*,BasicBlock*> LCases; DenseMap<Constant*, BasicBlock*> LCases;
for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end(); for (SwitchInst::CaseIt I = LI->case_begin(), E = LI->case_end();
I != E; ++I) I != E; ++I)
LCases[I.getCaseValue()] = I.getCaseSuccessor(); LCases[I.getCaseValueEx()] = I.getCaseSuccessor();
for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end(); for (SwitchInst::CaseIt I = RI->case_begin(), E = RI->case_end();
I != E; ++I) { I != E; ++I) {
ConstantInt *CaseValue = I.getCaseValue(); ConstantRangesSet CaseValue = I.getCaseValueEx();
BasicBlock *LCase = LCases[CaseValue]; BasicBlock *LCase = LCases[CaseValue];
if (LCase) { if (LCase) {
if (TryUnify) tryUnify(LCase, I.getCaseSuccessor()); if (TryUnify) tryUnify(LCase, I.getCaseSuccessor());
@ -338,7 +338,7 @@ class FunctionDifferenceEngine {
} }
} }
if (!Difference) if (!Difference)
for (DenseMap<ConstantInt*,BasicBlock*>::iterator for (DenseMap<Constant*, BasicBlock*>::iterator
I = LCases.begin(), E = LCases.end(); I != E; ++I) { I = LCases.begin(), E = LCases.end(); I != E; ++I) {
if (Complain) if (Complain)
Engine.logf("left switch has extra case %l") << I->first; Engine.logf("left switch has extra case %l") << I->first;