aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index cc95c49..d1343cb 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -625,27 +625,38 @@ struct InstructionMapper {
const TargetInstrInfo &TII) {
unsigned Flags = TII.getMachineOutlinerMBBFlags(MBB);
+ // Set to true whenever we map an illegal number.
+ bool AddedIllegalLastTime = false;
for (MachineBasicBlock::iterator It = MBB.begin(), Et = MBB.end(); It != Et;
It++) {
// Keep track of where this instruction is in the module.
switch (TII.getOutliningType(It, Flags)) {
case InstrType::Illegal:
+ // If we added an illegal number last time, then don't add more of them.
+ // One number is all that is necessary to prevent matches on illegal
+ // instructions.
+ if (AddedIllegalLastTime)
+ break;
+ AddedIllegalLastTime = true;
mapToIllegalUnsigned(It);
break;
case InstrType::Legal:
+ AddedIllegalLastTime = false;
mapToLegalUnsigned(It);
break;
case InstrType::LegalTerminator:
mapToLegalUnsigned(It);
InstrList.push_back(It);
+ AddedIllegalLastTime = true;
UnsignedVec.push_back(IllegalInstrNumber);
IllegalInstrNumber--;
break;
case InstrType::Invisible:
+ AddedIllegalLastTime = false;
break;
}
}