[PATCH] D16669: [LICM] Keep metadata on control equivalent hoists

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 19:16:21 PST 2016


sanjoy created this revision.
sanjoy added a reviewer: igor-laevsky.
sanjoy added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

If the instruction we're hoisting out of a loop into its preheader is
guaranteed to have executed in the loop, then the metadata associated
with the instruction (e.g. !range or !dereferenceable) is valid in the
preheader.  This is because once we're in the preheader, we know we're
eventually going to reach the location the metadata was valid at.

This change makes LICM smarter around this, and helps it recognize cases
like these:

```
  do {
    int a = *ptr; !range !0
    ...
  } while (i++ < N);
```

= LICM =>

```
  int a = *ptr; !range !0
  do {
    ...
  } while (i++ < N);
```

Earlier we'd drop the `!range` metadata after hoisting the load from
`ptr`.

http://reviews.llvm.org/D16669

Files:
  lib/Transforms/Scalar/LICM.cpp
  test/Transforms/LICM/hoist-deref-load.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16669.46212.patch
Type: text/x-patch
Size: 4355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160128/42c1739e/attachment.bin>


More information about the llvm-commits mailing list