This is an archive of the discontinued LLVM Phabricator instance.

[LoopUtils, LV] Fix PR27246 (first-order recurrences)
ClosedPublic

Authored by mssimpso on Apr 11 2016, 10:32 AM.

Details

Summary

This patch ensures that when we detect first-order recurrences, we reject a phi node if its previous 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.

Diff Detail

Repository
rL LLVM

Event Timeline

mssimpso updated this revision to Diff 53275.Apr 11 2016, 10:32 AM
mssimpso retitled this revision from to [LoopUtils, LV] Fix PR27246 (first-order recurrences).
mssimpso updated this object.
mssimpso added a reviewer: mcrosier.
mssimpso added a subscriber: llvm-commits.
mcrosier accepted this revision.Apr 11 2016, 11:07 AM
mcrosier edited edge metadata.

LGTM with a minor nit.

lib/Transforms/Utils/LoopUtils.cpp
544 ↗(On Diff #53275)

This looks like your combining the fix with a NFC (i.e., replacing the original check with isLoopInvariant()). I'd prefer this patch only include the isa<PHINode> check and you can make the NFC in a subsequent patch.

This revision is now accepted and ready to land.Apr 11 2016, 11:07 AM

Thanks, Chad! I'll separate this into two patches.

This revision was automatically updated to reflect the committed changes.