diff options
author | Hal Finkel <hfinkel@anl.gov> | 2016-04-29 01:27:40 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2016-04-29 01:27:40 +0000 |
commit | 1b66f7e3c8374aa39e51f47d4e0742a5ba15f894 (patch) | |
tree | 2648bcbda151f859f6639017ed38d70fc1f709f1 /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
parent | ec24bbe332b4c341fc32328ee6aafa7b72aa1df7 (diff) | |
download | bcm5719-llvm-1b66f7e3c8374aa39e51f47d4e0742a5ba15f894.tar.gz bcm5719-llvm-1b66f7e3c8374aa39e51f47d4e0742a5ba15f894.zip |
[LoopVectorize] Keep hints from original loop on the vector loop
We need to keep loop hints from the original loop on the new vector loop.
Failure to do this meant that, for example:
void foo(int *b) {
#pragma clang loop unroll(disable)
for (int i = 0; i < 16; ++i)
b[i] = 1;
}
this loop would be unrolled. Why? Because we'd vectorize it, thus dropping the
hints that unrolling should be disabled, and then we'd unroll it.
llvm-svn: 267970
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 4a51fc9a97d..c993d2a73c7 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -3200,6 +3200,11 @@ void InnerLoopVectorizer::createEmptyLoop() { LoopVectorBody.push_back(VecBody); LoopScalarBody = OldBasicBlock; + // Keep all loop hints from the original loop on the vector loop (we'll + // replace the vectorizer-specific hints below). + if (MDNode *LID = OrigLoop->getLoopID()) + Lp->setLoopID(LID); + LoopVectorizeHints Hints(Lp, true); Hints.setAlreadyVectorized(); } |