[llvm-commits] [PATCH] Multidimensional Array Index Delinearization Analysis

Sameer Sahasrabuddhe sameer.sahasrabuddhe at amd.com
Wed Oct 3 00:20:59 PDT 2012


On Mon, 1 Oct 2012 10:32:46 -0700
Andrew Trick <atrick at apple.com> wrote:

> Still, it would be worth attempting to solve this problem without a
> separate polynomial package. I could imagine special-casing the
> solution for the kind of nested recurrences that we expect to see. It
> might also make sense to do the division "implicitly" without
> attempting to create a SCEVUDiv expression. I think you're only
> dealing with linear expressions of a fairly regular form. SCEV's
> ability to canonicalize and unqiue expressions certainly helps. I
> can't say for sure whether this will lead to a simpler
> implementation, but I hope you consider it.

I think this is the correct way to go for the delinearizer. Note that
the implicit division is already happening in the polynomial
package ... it can instead be ported to produce SCEVs as the quotient
and remainder.

Is the following statement a correct generalization of delinearization?

  (ab+c,+,as) = a*(b,+,s) + c

Note that we are not dividing the start by the step, but instead
extracting a GCD from both sides along with a remainder from the
start. Then `a' will be the co-efficient and `c' will be the quantity
added to the index.

If this idea makes sense, what are the conditions for the 
factorization to be correct?

In some sense, we are externally ``undoing'' the work done by the SCEV
constructors when they push loop-invariant terms into the AddRec.

Sameer.




More information about the llvm-commits mailing list