[PATCH] D27193: MachineLoopInfo: add function findInductionRegister.

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 01:32:36 PST 2016


SjoerdMeijer added inline comments.


================
Comment at: include/llvm/CodeGen/MachineLoopInfo.h:176
+  /// IVBump is the immediate value added to R, and IVOp is the instruction
+  /// "R = R + #bump".
+  bool findInductionRegister(MachineLoop *L, unsigned &Reg, int64_t &IVBump,
----------------
kparzysz wrote:
> qcolombet wrote:
> > What do we do we more general representation?
> > E.g., R = R * 2
> > Or with R = R + RuntimeConstant?
> > 
> > Basically where I am going is shouldn't we have a representation a la SCEV?
> Runtime constants won't work, neither will *=.  This code was meant to get the typical "+= const" patterns.
> 
> 
> Regarding the M-SCEV: yes, we should have it.  What's missing is the time to do it.  :)
> 
> It's been on my to-do-eventually list, and my idea was to use some sort of a common underlying representation of instructions (i.e. all add instructions for all targets would be represented as a generic "add" instruction). Now that we have GlobalISel, this groundwork is in place, we could develop some sort of a translation scheme from MIR to GIR(?), and then develop SCEV on top of that.
Thanks for the reviews.  Yes, I agree, the recognised loops will be simple loops, and thus the approach is not very general, but it could serve some purposes though. Or now that GlobalIsel is being developed, is this technical debt that we don't want to develop further? I haven't followed the development of GlobalIsel close enough, but is it stable enough that we could be looking into SCEVs for machine instructions/GIR?


https://reviews.llvm.org/D27193





More information about the llvm-commits mailing list