summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorMatthew Simpson <mssimpso@codeaurora.org>2016-04-11 19:48:18 +0000
committerMatthew Simpson <mssimpso@codeaurora.org>2016-04-11 19:48:18 +0000
commit53207a99f9d6a93c12bf0114556a7f0dd7e87d1f (patch)
tree7ee64cdd7d55a156114c4dc17e8d3f29b9dfcafc /llvm/lib/Transforms/Utils/LoopUtils.cpp
parentbbf78cda2acd46f614aa263401c3b4f18e1db7c7 (diff)
downloadbcm5719-llvm-53207a99f9d6a93c12bf0114556a7f0dd7e87d1f.tar.gz
bcm5719-llvm-53207a99f9d6a93c12bf0114556a7f0dd7e87d1f.zip
[LoopUtils, LV] Fix PR27246 (first-order recurrences)
This patch ensures that when we detect first-order recurrences, we reject a phi node if its previous value is also a phi node. During vectorization the initial and previous values of the recurrence are shuffled together to create the value for the current iteration. However, phi nodes are not widened like other instructions. This fixes PR27246. Differential Revision: http://reviews.llvm.org/D18971 llvm-svn: 265983
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index c18887f697e..a2964c38a87 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -541,7 +541,7 @@ bool RecurrenceDescriptor::isFirstOrderRecurrence(PHINode *Phi, Loop *TheLoop,
// Get the previous value. The previous value comes from the latch edge while
// the initial value comes form the preheader edge.
auto *Previous = dyn_cast<Instruction>(Phi->getIncomingValueForBlock(Latch));
- if (!Previous || !TheLoop->contains(Previous))
+ if (!Previous || !TheLoop->contains(Previous) || isa<PHINode>(Previous))
return false;
// Ensure every user of the phi node is dominated by the previous value. The
OpenPOWER on IntegriCloud