[PATCH] D110527: [llvm-reduce] Add MIR support.

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 13:16:19 PDT 2021


aeubanks added inline comments.


================
Comment at: llvm/test/tools/llvm-reduce/mir/instr-reduce.mir:4
+
+# REQUIRES: plugins
+# REQUIRES: riscv-registered-target
----------------
why does this need plugins?


================
Comment at: llvm/tools/llvm-reduce/DeltaManager.cpp:92
 #define DELTA_PASS(NAME, FUNC) OS << "  " << NAME << "\n";
-  DELTA_PASSES
+  if (ReduceModeMIR) {
+    DELTA_PASSES_MIR
----------------
I think we can probably always print everything here, split into IR and MIR passes


================
Comment at: llvm/tools/llvm-reduce/ReducerWorkItem.h:21
+  std::shared_ptr<Module> M;
+  std::unique_ptr<MachineFunction> MF;
+  void print(raw_ostream &ROS, void *p = nullptr) const;
----------------
I'm not super familiar with MIR, but do we only support one function at a time?


================
Comment at: llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp:21
+#include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/Support/Debug.h"
+
----------------
is this include needed?


================
Comment at: llvm/tools/llvm-reduce/llvm-reduce.cpp:127-134
+  ReduceModeMIR = false;
+  if (InputLanguage != "") {
+    if (InputLanguage != "ir" && InputLanguage != "mir") {
+      errs() << Argv[0] << ": input language must be '', 'ir' or 'mir'\n";
+      return 1;
+    }
+    if (InputLanguage == "mir")
----------------
a `cl::opt` with `cl::values` would be nicer, see `debug-pass-manager` in `NewPMDriver.cpp`


================
Comment at: llvm/tools/llvm-reduce/llvm-reduce.cpp:79
+                 cl::desc("Set the target triple"));
+cl::opt<bool> EnableMIR("mir", cl::desc("MIR mode"));
 
----------------
markus wrote:
> aeubanks wrote:
> > it'd be nice if we could automatically infer this from the input (like `llc`)
> Yeah, but maybe we can save that for later as well.
could you add a TODO?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110527/new/

https://reviews.llvm.org/D110527



More information about the llvm-commits mailing list