[PATCH] D150855: MachineCombiner: consider all uses in getLatency()

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 05:20:46 PDT 2023


barannikov88 added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineCombiner.cpp:286
+            NewRoot, NewRoot->findRegisterDefOperandIdx(MO.getReg()), &UseInstr,
+            MO.getOperandNo());
+      } else {
----------------
barannikov88 wrote:
> This now gets the operand number of the defining instruction. We need the operand number of the using instruction here; it is likely to be different.
> Please consider using `use_nodbg_operands`. You can get the UseInstr from it by calling `UseMO.getParent()`.
> 
(FWIW `NewRoot->findRegisterDefOperandIdx(MO.getReg())` could probably also be simplified to `MO.getOperandNo()`, but I'm sure. Perhaps there was a reason for not doing so. This is not a change request.)



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150855



More information about the llvm-commits mailing list