BlockGenerator: Recompute values from SCEV before handing back the original values
authorTobias Grosser <tobias@grosser.es>
Wed, 5 Nov 2014 20:48:56 +0000 (20:48 +0000)
committerTobias Grosser <tobias@grosser.es>
Wed, 5 Nov 2014 20:48:56 +0000 (20:48 +0000)
commit16371acdc45bc2c41efa0cbe39d1e2b4638d6ff8
tree48397bc6367e6a8912044eabce8ebcf7d17907f6
parent68a79a790c56ccdf6a9819d4a44f53ca8898a7bd
BlockGenerator: Recompute values from SCEV before handing back the original values

This patch moves the SCEV based (re)generation of values before the checking for
scop-constant terms. It enables us to provide SCEV based replacements, which
are necessary to correctly generate OpenMP subfunctions when using the SCEV
based code generation.

When recomputing a new value for a value used in the code of the original scop,
we previously directly returned the same original value for all scop-constant
expressions without even trying to regenerate these values using our SCEV
expression. This is correct when the newly generated code remains fully in the
same function, however in case we want to outline parts of the newly generated
scop into subfunctions, this approach means we do not have any opportunity to
update these values in the SCEV based code generation. (In the non-SCEV based
code generation, we can provide such updates through the GlobalMap). To ensure
we have this opportunity, we first try to regenerate scalar terms with our SCEV
builder and will only return scop-constant expressions if SCEV based code
generation was not possible.

This change should not affect the results of the existing code generation
passes. It only impacts the upcoming OpenMP based code generation.

This commit also adds a test case. This test case passes before and after this
commit. It was added to ensure test coverage for the changed code.

llvm-svn: 221393
polly/include/polly/CodeGen/BlockGenerators.h
polly/lib/CodeGen/BlockGenerators.cpp
polly/test/Isl/CodeGen/scalar-references-used-in-scop-compute.ll [new file with mode: 0644]