[LAA] Add recursive IR walker for forked pointers
authorGraham Hunter <graham.hunter@arm.com>
Thu, 16 Jun 2022 08:59:29 +0000 (09:59 +0100)
committerGraham Hunter <graham.hunter@arm.com>
Mon, 18 Jul 2022 11:06:17 +0000 (12:06 +0100)
commitdb8fcb2c2537fa1aa71d7d8fb94545408a8085d2
tree66bfd51d3b2091c2b62255a3da4a62e1d59c44a5
parentca2e3ffbc1effe34a2dddaabc0a1412b09f8ca60
[LAA] Add recursive IR walker for forked pointers

This builds on the previous forked pointers patch, which only accepted
a single select as the pointer to check. A recursive function to walk
through IR has been added, which searches for either a loop-invariant
or addrec SCEV.

This will only handle a single fork at present, so selects of selects
or a GEP with a select for both the base and offset will be rejected.

There is also a recursion limit with a cli option to change it.

Reviewed By: fhahn, david-arm

Differential Revision: https://reviews.llvm.org/D108699
llvm/lib/Analysis/LoopAccessAnalysis.cpp
llvm/test/Analysis/LoopAccessAnalysis/forked-pointers.ll
llvm/test/Transforms/LoopVectorize/forked-pointers.ll