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

Sebastian Pop spop at codeaurora.org
Fri Oct 11 14:17:24 PDT 2013


Arnold Schwaighofer wrote:

> Interesting, in such a framework - if I understand you correctly - whenever we
> simplify an expression we would have to try several assumptions: a harder

I think SCEV folding could compute the assumptions needed to simplify the
expression. Let's take the example from the bug report:
http://llvm.org/bugs/show_bug.cgi?id=16358

> 8 * (zext i32 ({0,+,2}%<for_body>) to i64)+ %C_aligned
> 8 * (zext i32 ({1,+,2}%<for_body>) to i64)+ %C_aligned
> Without knowing that for the loop <for_body> the functions "{0,+,2}%<for_body>"
> and "{1,+2}%<for_body>" don’t wrap, SCEV cannot remove the zext.

simplify would recursively reconstruct the SCEV, so it would first dive in the
innermost expression, and the first assumption it would extract is from
simplifying (zext i32 ({0,+,2}%<for_body>) to i64)

simplify(zext i32 ({0,+,2}%<for_body>) to i64) = {0,+,2}%<for_body> assuming
{0,+,2}%<for_body> does not wrap, i.e., 2*N < 2**32

simplify would produce two constraints:

2*N < 2**32
2*N+1 < 2**32

we should keep the one satisfying both simplified expressions:
2*N+1 < 2**32

> problem?  In such a scenario, could we have several combinations of
> assumptions leading to different results with maybe different simplified
> expressions? 

Do you have an example where we could extract different constraints and produce
different simplified expressions?

> Is there a canonical such simplified expression? Is that the
> useful one? (It seems to me that would be a constant/loop invariant
> combination, assume loop count = 0 or 1). How do you guide the search in that
> tree of assumptions to find the answer we care about?
> 
> Can you elaborate more how that would work?
> 
> - - -
> 
> Alternatively. 
> 
> The above concern is why I would feed a set of assumptions to said framework:
> 
> NewSCEV = simplifyingSCEVFramework(SE, {set of assumptions}, SCEV).

I like SCEV to find the set of assumptions under which things simplify nicely,
otherwise I agree with you that it is difficult to find out which assumptions to
feed the SCEV simplifier.

Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation



More information about the llvm-commits mailing list