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

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 4 05:44:48 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))
----------------
phoebewang wrote:

> Or maybe your suggestion to replace the invocation to `.isCopyLike()` with just the subreg is best.

Yes. That's my suggestion. `SUBREG_TO_REG` is target independent instruction.

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


More information about the llvm-commits mailing list