1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
llvm-mirror/lib/Transforms
Justin Lebar 19453c8511 [LoopUnroll] Respect the convergent attribute.
Summary:
Specifically, when we perform runtime loop unrolling of a loop that
contains a convergent op, we can only unroll k times, where k divides
the loop trip multiple.

Without this change, we'll happily unroll e.g. the following loop

  for (int i = 0; i < N; ++i) {
    if (i == 0) convergent_op();
    foo();
  }

into

  int i = 0;
  if (N % 2 == 1) {
    convergent_op();
    foo();
    ++i;
  }
  for (; i < N - 1; i += 2) {
    if (i == 0) convergent_op();
    foo();
    foo();
  }.

This is unsafe, because we've just added a control-flow dependency to
the convergent op in the prelude.

In general, runtime unrolling loops that contain convergent ops is safe
only if we don't have emit a prelude, which occurs when the unroll count
divides the trip multiple.

Reviewers: resistor

Subscribers: llvm-commits, mzolotukhin

Differential Revision: http://reviews.llvm.org/D17526

llvm-svn: 263509
2016-03-14 23:15:34 +00:00
..
Hello Remove autoconf support 2016-01-26 21:29:08 +00:00
InstCombine [attrs] Handle convergent CallSites. 2016-03-14 20:18:54 +00:00
Instrumentation Remove PreserveNames template parameter from IRBuilder 2016-03-13 21:05:13 +00:00
IPO Revert "[ThinLTO] Renaming of function index to module summary index (NFC)" 2016-03-14 21:18:10 +00:00
ObjCARC ADT: Remove == and != comparisons between ilist iterators and pointers 2016-02-21 20:39:50 +00:00
Scalar [LoopUnroll] Respect the convergent attribute. 2016-03-14 23:15:34 +00:00
Utils [LoopUnroll] Respect the convergent attribute. 2016-03-14 23:15:34 +00:00
Vectorize [SLPVectorizer] Fix dependency list 2016-03-14 20:04:24 +00:00
CMakeLists.txt
LLVMBuild.txt