diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2016-03-03 16:12:01 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2016-03-03 16:12:01 +0000 |
commit | b840a6d6f40bc487865f32a87a7e092326029e2c (patch) | |
tree | 2200333fa632325b200616d515522e98d9e81e2c /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | d6cb4ec2a23f2f659f2e88407799db58ef4efe35 (diff) | |
download | bcm5719-llvm-b840a6d6f40bc487865f32a87a7e092326029e2c.tar.gz bcm5719-llvm-b840a6d6f40bc487865f32a87a7e092326029e2c.zip |
[LoopUtils, LV] Fix PR26734
The vectorization of first-order recurrences (r261346) caused PR26734. When
detecting these recurrences, we need to ensure that the previous value is
actually defined inside the loop. This patch includes the fix and test case.
llvm-svn: 262624
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 42ba0124db1..1f84eca6059 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -543,7 +543,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) + if (!Previous || !TheLoop->contains(Previous)) return false; // Ensure every user of the phi node is dominated by the previous value. The |