[LV] Pick correct BB as insert point when fixing PHI for FORs.
authorFlorian Hahn <flo@fhahn.com>
Sat, 7 Dec 2019 17:29:07 +0000 (17:29 +0000)
committerFlorian Hahn <flo@fhahn.com>
Sat, 7 Dec 2019 19:32:00 +0000 (19:32 +0000)
commitc49194969430f0ee817498a7000a979a7a0ded03
tree2ecaf22d41f674ecf0cf9796017d0911e1a59867
parent4ec7bb42aa67b8a03a9be497dd44195990c3ac74
[LV] Pick correct BB as insert point when fixing PHI for FORs.

Currently we fail to pick the right insertion point when
PreviousLastPart of a first-order-recurrence is a PHI node not in the
LoopVectorBody. This can happen when PreviousLastPart is produce in a
predicated block. In that case, we should pick the insertion point in
the BB the PHI is in.

Fixes PR44020.

Reviewers: hsaito, fhahn, Ayal, dorit

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D71071
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/SystemZ/predicated-first-order-recurrence.ll [new file with mode: 0644]