OSDN Git Service

[LoopVectorize] Annotate versioned loop with noalias metadata
authorAdam Nemet <anemet@apple.com>
Thu, 17 Mar 2016 20:32:37 +0000 (20:32 +0000)
committerAdam Nemet <anemet@apple.com>
Thu, 17 Mar 2016 20:32:37 +0000 (20:32 +0000)
commit367051414e567f95019d2f6cb7c029875b3dd51f
tree910be3bbfd1a2feb5471c99a72bea1cc87143096
parent02642946ce59ac317fb9e37aed969d474fdf2d85
[LoopVectorize] Annotate versioned loop with noalias metadata

Summary:
Use the new LoopVersioning facility (D16712) to add noalias metadata in
the vector loop if we versioned with memchecks.  This can enable some
optimization opportunities further down the pipeline (see the included
test or the benchmark improvement quoted in D16712).

The test also covers the bug I had in the initial version in D16712.

The vectorizer did not previously use LoopVersioning.  The reason is
that the vectorizer performs its transformations in single shot.  It
creates an empty single-block vector loop that it then populates with
the widened, if-converted instructions.  Thus creating an intermediate
versioned scalar loop seems wasteful.

So this patch (rather than bringing in LoopVersioning fully) adds a
special interface to LoopVersioning to allow the vectorizer to add
no-alias annotation while still performing its own versioning.

As the vectorizer propagates metadata from the instructions in the
original loop to the vector instructions we also check the pointer in
the original instruction and see if LoopVersioning can add no-alias
metadata based on the issued memchecks.

Reviewers: hfinkel, nadav, mzolotukhin

Subscribers: mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263744 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/LoopVersioning.h
lib/Transforms/Utils/LoopVersioning.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/noalias-md-licm.ll [new file with mode: 0644]
test/Transforms/LoopVectorize/noalias-md.ll [new file with mode: 0644]