OSDN Git Service

[SCEV] Assume parameters coming from function calls contain IVs
authorTobias Grosser <tobias@grosser.es>
Sat, 27 May 2017 15:17:49 +0000 (15:17 +0000)
committerTobias Grosser <tobias@grosser.es>
Sat, 27 May 2017 15:17:49 +0000 (15:17 +0000)
commit4439d654fd0a9bb2aa79fc3045d18a59137a504e
tree30eacc31fee07dc029bc24896e9fc1c03000819a
parent8cbe21fcdd18ee0aab25642e3ed06018b3b1fd3f
[SCEV] Assume parameters coming from function calls contain IVs

The optimistic delinearization implemented in LLVM detects array sizes by
looking for non-linear products between parameters and induction variables.
In OpenCL code, such products often look like:

  A[get_global_id(0) * N + get_global_id(1)]

Hence, the IV is hidden in the get_global_id() call and consequently
delinearization would fail as no induction variable is available that helps
us to identify N as array size parameter.

We now use a very simple heuristic to change this. We assume that each parameter
that comes directly from a function call is a hidden induction variable. As
a result, we can delinearize the access above to:

  A[get_global_id(0)][get_global_id(1]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304073 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScalarEvolution.cpp
test/Analysis/Delinearization/constant_functions_multi_dim.ll [new file with mode: 0644]