[PATCH] D36800: Add rewrite by-reference parameter pass

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 16 10:27:12 PDT 2017


grosser created this revision.
grosser added a project: Polly.
Herald added a subscriber: mgorny.

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.


https://reviews.llvm.org/D36800

Files:
  include/polly/LinkAllPasses.h
  lib/CMakeLists.txt
  lib/Support/RegisterPasses.cpp
  lib/Transform/Canonicalization.cpp
  lib/Transform/RewriteByReferenceParameters.cpp
  test/RewriteByReferenceParameters/fortran_io.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36800.111380.patch
Type: text/x-patch
Size: 7870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170816/1ef89cea/attachment-0001.bin>


More information about the llvm-commits mailing list