[llvm] [MachineLICM] Hoist copies of constant physical register (PR #93285)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon May 27 14:24:50 PDT 2024
================
@@ -1269,8 +1269,9 @@ bool MachineLICMBase::IsProfitableToHoist(MachineInstr &MI,
Register DefReg = MI.getOperand(0).getReg();
if (DefReg.isVirtual() &&
all_of(MI.uses(),
- [](const MachineOperand &UseOp) {
- return !UseOp.isReg() || UseOp.getReg().isVirtual();
+ [&](const MachineOperand &UseOp) {
+ return !UseOp.isReg() || UseOp.getReg().isVirtual() ||
+ MRI->isConstantPhysReg(UseOp.getReg());
----------------
arsenm wrote:
MRI is only capture,
```suggestion
[=this](const MachineOperand &UseOp) {
return !UseOp.isReg() || UseOp.getReg().isVirtual() ||
MRI->isConstantPhysReg(UseOp.getReg());
```
https://github.com/llvm/llvm-project/pull/93285
More information about the llvm-commits
mailing list