Add rewrite by-reference parameter pass
commit9a664808c5c6300c52a2410295025a2f9ba833a8
authorTobias Grosser <tobias@grosser.es>
Thu, 17 Aug 2017 05:25:08 +0000 (17 05:25 +0000)
committerTobias Grosser <tobias@grosser.es>
Thu, 17 Aug 2017 05:25:08 +0000 (17 05:25 +0000)
tree5545221c3d1d1da21fe7b3aed6c84e3528bbd8c7
parentfdde8e9612bc20287d4e68ea177dfe72b03fed97
Add rewrite by-reference parameter pass

Summary:
This pass detangles induction variables from functions, which take variables by
reference. Most fortran functions compiled with gfortran pass variables by
reference. Unfortunately a common pattern, printf calls of induction variables,
prevent in this situation the promotion of the induction variable to a register,
which again inhibits any kind of loop analysis. To work around this issue
we developed a specialized pass which introduces separate alloca slots for
known-read-only references, which indicate the mem2reg pass that the induction
variables can be promoted to registers and consquently enable SCEV to work.

We currently hardcode the information that a function
_gfortran_transfer_integer_write does not read its second parameter, as
dragonegg does not add the right annotations and we cannot change old dragonegg
releases. Hopefully flang will produce the right annotations.

Reviewers: Meinersbur, bollu, singam-sanjay

Reviewed By: bollu

Subscribers: mgorny, pollydev, llvm-commits

Tags: #polly

Differential Revision: https://reviews.llvm.org/D36800

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@311066 91177308-0d34-0410-b5e6-96231b3b80d8
include/polly/LinkAllPasses.h
lib/CMakeLists.txt
lib/Support/RegisterPasses.cpp
lib/Transform/Canonicalization.cpp
lib/Transform/RewriteByReferenceParameters.cpp [new file with mode: 0644]
test/RewriteByReferenceParameters/fortran_io.ll [new file with mode: 0644]