[PATCH] Experiment with keeping GEPs near calls
Daniel Jasper
djasper at google.com
Fri Mar 13 02:26:16 PDT 2015
================
Comment at: lib/CodeGen/MachineLICM.cpp:776
@@ +775,3 @@
+ I != Preheader->instr_end(); ++I) {
+ if (IsLoopInvariantInst(*I) && !HasLoopPHIUse(I))
+ Candidates.push_back(I);
----------------
qcolombet wrote:
> A comment here would be welcome.
> I suspect you are just interested in the fact that the instruction shouldn't use or define physical registers as well as memory operand (which is part of what this function does).
> Without a comment, at first glance, this is confusing because instructions in the preheader should be loop invariant!
Added comment and removed HasLoopPHIUse, which I am no longer sure is necessary.
================
Comment at: lib/CodeGen/MachineLICM.cpp:782
@@ +781,3 @@
+ const MachineOperand &MO = I->getOperand(0);
+ if (!MO.isDef() || !MO.isReg() || MO.getReg() == 0)
+ continue;
----------------
qcolombet wrote:
> The idiom is usually !MO.getReg()
Done.
================
Comment at: lib/CodeGen/MachineLICM.cpp:789
@@ +788,3 @@
+ for (MachineInstr &MI : MRI->use_instructions(MO.getReg())) {
+ if (!MI.isCopy()) {
+ CanSink = false;
----------------
qcolombet wrote:
> I believe this check shouldn't be needed for the general approach.
I generally agree, but we need some sort of cost model. And for now, assuming that we'd always want to sink copies seems like a reasonable first one. Added a comment to this effect.
http://reviews.llvm.org/D7259
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list