[llvm] [MachineLICM] Let targets decide if copy-like instructions are cheap (PR #146599)

Guy David via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 08:18:05 PDT 2025


================
@@ -1219,7 +1219,7 @@ bool MachineLICMImpl::HasHighOperandLatency(MachineInstr &MI, unsigned DefIdx,
 /// Return true if the instruction is marked "cheap" or the operand latency
 /// between its def and a use is one or less.
 bool MachineLICMImpl::IsCheapInstruction(MachineInstr &MI) const {
-  if (TII->isAsCheapAsAMove(MI) || MI.isCopyLike())
+  if (TII->isAsCheapAsAMove(MI))
----------------
guy-david wrote:

The comparison is just the diff introduced in this PR. Why is it counter-intuitive? It seems to me that even though this instruction is cheap, it's not free and executing it just once may help performance.

https://github.com/llvm/llvm-project/pull/146599


More information about the llvm-commits mailing list