mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-11 18:42:01 +00:00
Fix polarity of a CFG check in machine verifier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88704 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
24f8e29b4e
commit
1dc0fcbaed
@ -287,7 +287,18 @@ void MachineVerifier::visitMachineFunctionBefore() {
|
|||||||
markReachable(&MF->front());
|
markReachable(&MF->front());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
// Does iterator point to a and b as the first two elements?
|
||||||
|
bool matchPair(MachineBasicBlock::const_succ_iterator i,
|
||||||
|
const MachineBasicBlock *a, const MachineBasicBlock *b) {
|
||||||
|
if (*i == a)
|
||||||
|
return *++i == b;
|
||||||
|
if (*i == b)
|
||||||
|
return *++i == a;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB) {
|
||||||
const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
|
const TargetInstrInfo *TII = MF->getTarget().getInstrInfo();
|
||||||
|
|
||||||
// Start with minimal CFG sanity checks.
|
// Start with minimal CFG sanity checks.
|
||||||
@ -379,8 +390,7 @@ void MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB)
|
|||||||
} if (MBB->succ_size() != 2) {
|
} if (MBB->succ_size() != 2) {
|
||||||
report("MBB exits via conditional branch/fall-through but doesn't have "
|
report("MBB exits via conditional branch/fall-through but doesn't have "
|
||||||
"exactly two CFG successors!", MBB);
|
"exactly two CFG successors!", MBB);
|
||||||
} else if ((MBB->succ_begin()[0] == TBB && MBB->succ_end()[1] == MBBI) ||
|
} else if (!matchPair(MBB->succ_begin(), TBB, MBBI)) {
|
||||||
(MBB->succ_begin()[1] == TBB && MBB->succ_end()[0] == MBBI)) {
|
|
||||||
report("MBB exits via conditional branch/fall-through but the CFG "
|
report("MBB exits via conditional branch/fall-through but the CFG "
|
||||||
"successors don't match the actual successors!", MBB);
|
"successors don't match the actual successors!", MBB);
|
||||||
}
|
}
|
||||||
@ -400,8 +410,7 @@ void MachineVerifier::visitMachineBasicBlockBefore(const MachineBasicBlock *MBB)
|
|||||||
if (MBB->succ_size() != 2) {
|
if (MBB->succ_size() != 2) {
|
||||||
report("MBB exits via conditional branch/branch but doesn't have "
|
report("MBB exits via conditional branch/branch but doesn't have "
|
||||||
"exactly two CFG successors!", MBB);
|
"exactly two CFG successors!", MBB);
|
||||||
} else if ((MBB->succ_begin()[0] == TBB && MBB->succ_end()[1] == FBB) ||
|
} else if (!matchPair(MBB->succ_begin(), TBB, FBB)) {
|
||||||
(MBB->succ_begin()[1] == TBB && MBB->succ_end()[0] == FBB)) {
|
|
||||||
report("MBB exits via conditional branch/branch but the CFG "
|
report("MBB exits via conditional branch/branch but the CFG "
|
||||||
"successors don't match the actual successors!", MBB);
|
"successors don't match the actual successors!", MBB);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user