[polly] r222754 - Assume GetElementPtr offsets to be inbounds

Tobias Grosser tobias at grosser.es
Tue Nov 25 23:54:52 PST 2014


On 25.11.2014 11:51, Tobias Grosser wrote:
> Author: grosser
> Date: Tue Nov 25 04:51:12 2014
> New Revision: 222754
>
> URL: http://llvm.org/viewvc/llvm-project?rev=222754&view=rev
> Log:
> Assume GetElementPtr offsets to be inbounds
>
> In case a GEP instruction references into a fixed size array e.g., an access
> A[i][j] into an array A[100x100], LLVM-IR does not guarantee that the subscripts
> always compute values that are within array bounds. We now derive the set of
> parameter values for which all accesses are within bounds and add the assumption
> that the scop is only every executed with this set of parameter values.
>
> Example:
>
> void foo(float A[][20], long n, long m {
>      for (long i = 0; i < n; i++)
>        for (long j = 0; j < m; j++)
>          A[i][j] = ...
>
> This loop yields out-of-bound accesses if m is at least 20 and at the same time
> at least one iteration of the outer loop is executed. Hence, we assume:
>
>    n <= 0 or m <= 20.
>
> Doing so simplifies the dependence analysis problem, allows us to perform
> more optimizations and generate better code.
 >
> TODO: The location where the GEP instruction is executed is not necessarily the
> location where the memory is actually accessed. As a result scanning for GEP[s]
> is imprecise. Even though this is not a correctness problem, this imprecision
> may result in missed optimizations or non-optimal run-time checks.
>
> In polybench where this mismatch between parametric loop bounds and fixed size
> arrays is common, we see with this patch significant reductions in compile time
> (up to 50%) and execution time (up to 70%). We see two significant compile time
> regressions (fdtd-2d, jacobi-2d-imper), and one execution time regression
> (trmm).  Both regressions arise due to additional optimizations that have been
> enabled by this patch. They can be addressed in subsequent commits.

Here the corresponding LNT results:

http://llvm.org/perf/db_default/v4/nts/34106?num_comparison_runs=0&test_filter=&test_min_value_filter=&aggregation_fn=median&MW_confidence_lv=0.05&compare_to=34078&submit=Update

Tobias




More information about the llvm-commits mailing list