[PATCH] D33562: MachineLICM: Add new condition for hoisting of caller preserved registers
Matthias Braun via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 11:29:06 PDT 2017
MatzeB added inline comments.
================
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;
----------------
lei wrote:
> 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;
> ```
yes of course, my point was to check the ConstantPhysReg condition first and then the isCallerPreservedPhysReg which this does fine.
https://reviews.llvm.org/D33562
More information about the llvm-commits
mailing list