[GlobalISel] Teach the core pipeline not to run if ISel failed.
authorQuentin Colombet <qcolombet@apple.com>
Sat, 27 Aug 2016 00:18:24 +0000 (00:18 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Sat, 27 Aug 2016 00:18:24 +0000 (00:18 +0000)
llvm-svn: 279889

llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
llvm/lib/CodeGen/GlobalISel/MachineLegalizePass.cpp
llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp

index 4ef4c43..302c376 100644 (file)
@@ -43,6 +43,11 @@ static void reportSelectionError(const MachineInstr &MI, const Twine &Message) {
 }
 
 bool InstructionSelect::runOnMachineFunction(MachineFunction &MF) {
+  // If the ISel pipeline failed, do not bother running that pass.
+  if (MF.getProperties().hasProperty(
+          MachineFunctionProperties::Property::FailedISel))
+    return false;
+
   DEBUG(dbgs() << "Selecting function: " << MF.getName() << '\n');
 
   const InstructionSelector *ISel = MF.getSubtarget().getInstructionSelector();
index bf50252..33d050b 100644 (file)
@@ -37,6 +37,10 @@ void MachineLegalizePass::init(MachineFunction &MF) {
 }
 
 bool MachineLegalizePass::runOnMachineFunction(MachineFunction &MF) {
+  // If the ISel pipeline failed, do not bother running that pass.
+  if (MF.getProperties().hasProperty(
+          MachineFunctionProperties::Property::FailedISel))
+    return false;
   DEBUG(dbgs() << "Legalize Machine IR for: " << MF.getName() << '\n');
   init(MF);
   const MachineLegalizer &Legalizer = *MF.getSubtarget().getMachineLegalizer();
index bf88d74..9efe48a 100644 (file)
@@ -537,6 +537,11 @@ void RegBankSelect::assignInstr(MachineInstr &MI) {
 }
 
 bool RegBankSelect::runOnMachineFunction(MachineFunction &MF) {
+  // If the ISel pipeline failed, do not bother running that pass.
+  if (MF.getProperties().hasProperty(
+          MachineFunctionProperties::Property::FailedISel))
+    return false;
+
   DEBUG(dbgs() << "Assign register banks for: " << MF.getName() << '\n');
   const Function *F = MF.getFunction();
   Mode SaveOptMode = OptMode;