[PATCH] D86522: [RISC-V] Implement RISCVInstrInfo::isCopyInstrImpl()

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 06:44:05 PDT 2020


luismarques added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:541-542
+  case RISCV::ADDI:
+  case RISCV::ORI:
+  case RISCV::XORI:
+    if (MI.getOperand(2).isImm() && MI.getOperand(2).getImm() == 0)
----------------
Do the `ORI`, `XORI` cases also provide a measurable benefit here, as they do for `isAsCheapAsAMove`? Taking a step back, is there a principled way to decide which instructions we include? I can see two cases that are easy to defend: (1) keeping only canonical move instructions; (2) adding all instructions that provide some benefit. Without tests it's not obvious to me that `ORI` and `XORI` fit the second case. Did you check if the commits for other uses of this hook had tests that we could adapt?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86522



More information about the llvm-commits mailing list