[PATCH] D113031: [GlobalISel] Add a bisection point after instruction selection.

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 10:18:35 PDT 2021


aemerson created this revision.
aemerson added reviewers: paquette, arsenm, foad, dsanders, qcolombet.
aemerson added a project: LLVM.
Herald added subscribers: hiraditya, rovka.
aemerson requested review of this revision.
Herald added a subscriber: wdng.

This uses the bisection support in D113030 <https://reviews.llvm.org/D113030>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113031

Files:
  llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp


Index: llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -33,6 +33,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/RemoteBisectorClient.h"
 #include "llvm/Target/TargetMachine.h"
 
 #define DEBUG_TYPE "instruction-select"
@@ -48,6 +49,11 @@
 static const std::string CoveragePrefix;
 #endif
 
+cl::opt<bool>
+    BisectISel("gisel-bisect-selection",
+               cl::desc("Enable remote bisection in GlobalISel after isel"),
+               cl::init(false));
+
 char InstructionSelect::ID = 0;
 INITIALIZE_PASS_BEGIN(InstructionSelect, DEBUG_TYPE,
                       "Select target instructions out of generic instructions",
@@ -300,6 +306,26 @@
     }
   }
 
+  if (BisectISel) {
+    RemoteBisectClient BisectClient;
+    // If we're building with multiple architectures, we could have conflicts
+    // with using just the module + function name. Add the triple arch to
+    // disambiguate further.
+    auto &M = *MF.getFunction().getParent();
+    std::string Arch = Triple(M.getTargetTriple()).getArchName().str();
+    std::string Key = Arch + " " +
+                      MF.getFunction().getParent()->getSourceFileName() + " " +
+                      MF.getFunction().getName().str();
+    if (!BisectClient.shouldPerformBisectAction(Key)) {
+      MachineOptimizationRemarkMissed R("gisel-bisect", "GISelFailure",
+                                        MF.getFunction().getSubprogram(),
+                                        &*MF.begin());
+      R << "bisection specified fall back";
+      reportGISelFailure(MF, TPC, MORE, R);
+      return false;
+    }
+  }
+
   // FIXME: FinalizeISel pass calls finalizeLowering, so it's called twice.
   auto &TLI = *MF.getSubtarget().getTargetLowering();
   TLI.finalizeLowering(MF);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113031.384151.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211102/d408fde1/attachment.bin>


More information about the llvm-commits mailing list