[llvm] [MachineLICM][AArch64] Hoist COPY instructions with other uses in the loop (PR #71403)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 8 01:25:04 PST 2023
================
@@ -1249,6 +1249,15 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI,
return false;
}
+ // If we have a COPY with other uses in the loop, hoist to allow the users to
+ // also be hoisted.
+ if (MI.isCopy() && IsLoopInvariantInst(MI, CurLoop) &&
+ MI.getOperand(0).isReg() && MI.getOperand(0).getReg().isVirtual() &&
+ MI.getOperand(1).isReg() && MI.getOperand(1).getReg().isVirtual() &&
+ any_of(MRI->use_nodbg_instructions(MI.getOperand(0).getReg()),
+ [&](MachineInstr &UseMI) { return CurLoop->contains(&UseMI); }))
----------------
arsenm wrote:
do you just need a value capture of CurLoop?
https://github.com/llvm/llvm-project/pull/71403
More information about the llvm-commits
mailing list