LLVM LoopDataPrefetch pass

Hi All,
I was wondering if you could help me with some pointers about the LoopDataPrefetch pass in LLVM. I am working on AArch64.

What I did

I found out that the pass is enabled by default, but to run we need to set: --prefetch-distance=K, with K>=1. I see now the pass running, but it stops here:

      const SCEV *LSCEV = SE->getSCEV(PtrValue);
      const SCEVAddRecExpr *LSCEVAddRec = dyn_cast<SCEVAddRecExpr>(LSCEV);
      if (!LSCEVAddRec)

In the above snippet, LSCEVAddRec is empty.

I dumped out things and:

  • The PtrValue looks similar to: %101 = bitcast float* %100 to <8 x float>*
  • The LSCEV variable is similar to: ((4 * (({{0,+,128}<%79>,+,1}<%91> * %96) + {0,+,8}<%81> + %95)) + %94)
  • The LSCEV->getType() is scAddExpr

How to proceed further?

I am trying to add prefetch in the inner-most loop of a nest composed by 5 loops (which is basically implementing a tiled GEMM). Is the loop too complicated to be prefetched? Is there any pointer I can use to understand what the pass is doing?

Thanks to anyone who can point me toward the right direction.