diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2016-09-26 17:08:37 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2016-09-26 17:08:37 +0000 |
commit | b764aba2aba7465421e33d761df5b94c50a2f415 (patch) | |
tree | d2e0b6361f98f0776ba2852be5e3a21ead092e88 /llvm/lib | |
parent | 5fa302cb65dd45743d9b5af26ca21500e8418bf2 (diff) | |
download | bcm5719-llvm-b764aba2aba7465421e33d761df5b94c50a2f415.tar.gz bcm5719-llvm-b764aba2aba7465421e33d761df5b94c50a2f415.zip |
[LV] Scalarize instructions marked scalar after vectorization
This patch ensures that we actually scalarize instructions marked scalar after
vectorization. Previously, such instructions may have been vectorized instead.
Differential Revision: https://reviews.llvm.org/D23889
llvm-svn: 282418
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 0b5d7351b60..06413546619 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -4506,6 +4506,15 @@ static bool mayDivideByZero(Instruction &I) { void InnerLoopVectorizer::vectorizeBlockInLoop(BasicBlock *BB, PhiVector *PV) { // For each instruction in the old loop. for (Instruction &I : *BB) { + + // Scalarize instructions that should remain scalar after vectorization. + if (!(isa<BranchInst>(&I) || isa<PHINode>(&I) || + isa<DbgInfoIntrinsic>(&I)) && + Legal->isScalarAfterVectorization(&I)) { + scalarizeInstruction(&I); + continue; + } + switch (I.getOpcode()) { case Instruction::Br: // Nothing to do for PHIs and BR, since we already took care of the |