[PATCH] D16522: BlockGenerators: Replace getNewScalarValue with getNewValue

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 24 10:36:53 PST 2016


grosser created this revision.
grosser added reviewers: jdoerfert, Meinersbur.
grosser added subscribers: llvm-commits, pollydev.

Both functions implement the same functionality, with the difference that
getNewScalarValue assumes that globals and out-of-scop scalars can be directly
reused without loading them from their corresponding stack slot. This is correct
for sequential code generation, but causes issues with outlining code e.g. for
OpenMP code generation. getNewValue handles such cases correctly.

Hence, we can replace getNewScalarValue with getNewValue. This is not only more
future proof, but also eliminates a bunch of code.

The only functionality that was available in getNewScalarValue that is lost
is the on-demand creation of scalar values. However, this is not necessary any
more as scalars are always loaded at the beginning of each basic block and will
consequently always be available when scalar stores are generated. As this was
not the case in older versions of Polly, it seems the on-demand loading is just
some older code that has not yet been removed.

Finally, generateScalarLoads also generated loads for values that are loop
invariant, available in GlobalMap and which are preferred over the ones loaded
in generateScalarLoads. Hence, we can just skip the code generation of such
scalar values, avoiding the generation of dead code.

http://reviews.llvm.org/D16522

Files:
  include/polly/CodeGen/BlockGenerators.h
  lib/CodeGen/BlockGenerators.cpp
  test/Isl/CodeGen/invariant_load_scalar_escape_alloca_sharing.ll
  test/Isl/CodeGen/phi-defined-before-scop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16522.45828.patch
Type: text/x-patch
Size: 6772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160124/d7a3e22d/attachment.bin>


More information about the llvm-commits mailing list