[PATCH] D16197: [LV] Vectorize first-order recurrences
Matthew Simpson via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 09:52:18 PST 2016
mssimpso marked 4 inline comments as done.
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3564-3567
@@ +3563,6 @@
+ // recurrences are of the form "current = phi(initial, previous)".
+ auto *Initial = Phi->getIncomingValue(0);
+ auto *Previous = Phi->getIncomingValue(1);
+ if (!OrigLoop->isLoopInvariant(Initial))
+ std::swap(Initial, Previous);
> anemet wrote:
> > assert that Previous is loop-invariant at this point?
> Good idea.
We actually want the previous value to be loop-varying here. The initial value should be loop-invariant. I've added this assertion as well as a few others.
More information about the llvm-commits