[PATCH] D110973: [DA] Handle mismatching loop levels by considering them non-linear

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 14:12:10 PDT 2022


bmahjour added a comment.

> The following crashes even with this patch:

I actually don't see any crashes with the examples provided, but I do see that A[s] is being treated as invariant, so it does seem to bypass the `getLoopDisposition` checks. I'm changing `checkSubscript` to look for the addrec loop in the nest as you've suggested.



================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:900
   const SCEV *Start = AddRec->getStart();
   const SCEV *Step = AddRec->getStepRecurrence(*SE);
   const SCEV *UB = SE->getBackedgeTakenCount(AddRec->getLoop());
----------------
Meinersbur wrote:
> [suggestion] `SCEVAddRecExpr` has a member `isAffine` that could be queried directly.
I think this change should be pursued as a separate patche. `isAffine` just checks the number of operands, and for example doesn't check that the step is invariant, so there could be some semantic differences.


================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:925
     Loops.set(mapDstLoop(AddRec->getLoop()));
   return checkSubscript(Start, LoopNest, Loops, IsSrc);
 }
----------------
Meinersbur wrote:
> This recursive call may also return false, in which case `Loops.set` has already been executed. (This may be irrelevant because when returning false, `Loops` is probably be ignored anyway).
Yes, `classifyPair` returns immediately if `checkSubscript` returns false, and the loop lists get destructed without being used.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110973/new/

https://reviews.llvm.org/D110973



More information about the llvm-commits mailing list