[PATCH] D16197: [LV] Vectorize pre-load recurrences

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 10:02:29 PST 2016


mssimpso created this revision.
mssimpso added reviewers: mcrosier, jmolloy, hfinkel, anemet, nadav.
mssimpso added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

This patch enables the vectorization of pre-load recurrences. A pre-load recurrence is a phi of loads for the current and previous loop iterations. For example:

```
for (int i = 0; i < n; ++i)
  b[i] = a[i] - a[i - 1];
```

In the example above, the load PRE of the GVN pass can often hoist a[i - 1] into the loop preheader. This leaves a phi node inside the loop containing values for the hoisted load and a[i]. Although GVN can create these phi nodes, they can also occur naturally.

In this patch, we add a new recurrence kind for these phi nodes and attempt to vectorize them if possible. Vectoriztion is performed by sinking the hoisted load back inside the loop. The vectorization cost estimate is updated accordingly.

Contributed-by: Matthew Simpson and Chad Rosier <mcrosier at codeaurora.org>


http://reviews.llvm.org/D16197

Files:
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Transforms/Utils/LoopUtils.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/AArch64/pre-load-recurrence.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16197.44897.patch
Type: text/x-patch
Size: 21199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160114/363d3663/attachment.bin>


More information about the llvm-commits mailing list