[clang-tools-extra] [clang] [llvm] [MachineLICM][AArch64] Hoist COPY instructions with other uses in the loop (PR #71403)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 12:04:08 PST 2023


================
@@ -1262,6 +1262,18 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI,
     return false;
   }
 
+  // If we have a COPY with other uses in the loop, hoist to allow the users to
----------------
bjope wrote:

It is a bit tricky of course, depending on the properties of the target. For a VLIW target like ours the COPY could be really cheap, at least if it can be executed in parallel with something else without increasing latency. A cross-bank copy might actually be fee (zero cycles) even if it is inside the loop. OTOH. if we need to spill/reload a register, then that could be much more expensive, even if it is hoisted to some outer loop.

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


More information about the cfe-commits mailing list