[PATCH] D33562: MachineLICM: Add new condition for hoisting of caller preserved registers
Lei Huang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 08:22:09 PDT 2017
lei added inline comments.
================
Comment at: include/llvm/Target/TargetRegisterInfo.h:505
+ /// after the call.
+ /// Used by MachineRegisterInfo::isCallerPreservedPhysReg().
+ virtual bool isCallerPreservedPhysReg(unsigned PhysReg,
----------------
MatzeB wrote:
> The last sentence is not true anymore.
will remove.
================
Comment at: lib/CodeGen/MachineLICM.cpp:895-898
+ // If the physreg is known to always be caller saved/restored then
+ // this use is safe to hoist
+ if (TRI->isCallerPreservedPhysReg(Reg, *I.getParent()->getParent()))
+ continue;
----------------
MatzeB wrote:
> Could you move this check below the !isConstantPhysReg check as I expect this to be a rare case.
This needs to be above !isConstantPhysReg which is an early function exit check where as this is just an loop exit check. MRI->isConstantPhysReg(X2) will return false which will cause this function to exit with false. I could combine the two into:
```
if (!MRI->isConstantPhysReg(Reg) && !(TRI->isCallerPreservedPhysReg(Reg, *I.getParent()->getParent())))
return false;
```
https://reviews.llvm.org/D33562
More information about the llvm-commits
mailing list