[PATCH] D32789: [ScopInfo] Do not use LLVM names to identify statements

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 03:15:12 PDT 2017


grosser created this revision.
grosser added a project: Polly.

LLVM-IR names are commonly available in debug builds, but often not in release
builds. Hence, using LLVM-IR names to identify statements or memory reference
results makes the behavior of Polly depend on the compile mode. This is
undesirable. Hence, we now just number the statements instead of using LLVM-IR
names to identify them (this issue has previously been brought up by Zino
Benaissa).

However, as LLVM-IR names help in making test cases more readable, we add an
option '-polly-use-llvmir-names' to still use LLVM-IR names. This flag
is by default set in the polly tests to make test cases more readable.

This change reduces the time in ScopInfo from 32 seconds to 2 seconds for the
following test case provided by Eli Friedman <efriedma at codeaurora.org> (already
used in one of the previous commits):

  struct X { int x; };
  void a();
  #define SIG (int x, X **y, X **z)
  typedef void (*fn)SIG;
  #define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); }
  #define FN5 FN FN FN FN FN
  #define FN25 FN5 FN5 FN5 FN5
  #define FN125 FN25 FN25 FN25 FN25 FN25
  #define FN250 FN125 FN125
  #define FN1250 FN250 FN250 FN250 FN250 FN250
  void x SIG { FN1250 }

For a larger benchmark I have on-hand (10000 loops), this reduces the time for
running -polly-scops from 5 minutes to 4 minutes, a reduction by 20%.

The reason for this large speedup is that our previous use of printAsOperand
had a quadratic cost, as for each printed and unnamed operand the full function
was scanned to find the instruction number that identifies the operand.

We do not need to adjust the way memory reference ids are constructured, as
they do not use LLVM values.


https://reviews.llvm.org/D32789

Files:
  include/polly/ScopInfo.h
  include/polly/Support/GICHelper.h
  lib/Analysis/ScopInfo.cpp
  lib/Support/GICHelper.cpp
  test/ScopInfo/unnamed_nonaffine.ll
  test/ScopInfo/unnamed_stmts.ll
  test/lit.site.cfg.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32789.97580.patch
Type: text/x-patch
Size: 20537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170503/3472bce2/attachment.bin>


More information about the llvm-commits mailing list