mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2332 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
35504209a0
commit
f2361c5e5c
@ -369,10 +369,15 @@ void MutateStructTypes::transformMethod(Function *m) {
|
||||
break;
|
||||
case Instruction::Br: {
|
||||
const BranchInst *BI = cast<BranchInst>(I);
|
||||
NewI = new BranchInst(
|
||||
cast<BasicBlock>(ConvertValue(BI->getSuccessor(0))),
|
||||
cast_or_null<BasicBlock>(ConvertValue(BI->getSuccessor(1))),
|
||||
ConvertValue(BI->getCondition()));
|
||||
if (BI->isConditional()) {
|
||||
NewI =
|
||||
new BranchInst(cast<BasicBlock>(ConvertValue(BI->getSuccessor(0))),
|
||||
cast<BasicBlock>(ConvertValue(BI->getSuccessor(1))),
|
||||
ConvertValue(BI->getCondition()));
|
||||
} else {
|
||||
NewI =
|
||||
new BranchInst(cast<BasicBlock>(ConvertValue(BI->getSuccessor(0))));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Instruction::Switch:
|
||||
|
@ -397,8 +397,8 @@ void SCCP::visitBranchInst(BranchInst *BI) {
|
||||
void SCCP::visitSwitchInst(SwitchInst *SI) {
|
||||
InstVal &SCValue = getValueState(SI->getCondition());
|
||||
if (SCValue.isOverdefined()) { // Overdefined condition? All dests are exe
|
||||
for(unsigned i = 0; BasicBlock *Succ = SI->getSuccessor(i); ++i)
|
||||
markExecutable(Succ);
|
||||
for(unsigned i = 0, E = SI->getNumSuccessors(); i != E; ++i)
|
||||
markExecutable(SI->getSuccessor(i));
|
||||
} else if (SCValue.isConstant()) {
|
||||
Constant *CPV = SCValue.getConstant();
|
||||
// Make sure to skip the "default value" which isn't a value
|
||||
|
Loading…
x
Reference in New Issue
Block a user