[LV] Extend InstWidening with CM_Widen_Recursive
authorHal Finkel <hfinkel@anl.gov>
Sat, 16 Dec 2017 02:55:24 +0000 (02:55 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sat, 16 Dec 2017 02:55:24 +0000 (02:55 +0000)
commit5444f409658e4b83adec4f300d70ef7a8da4c797
tree822afe003f18289c828d7d3fe0a45a61c2189fb9
parent5f8c84c5be80aba4770bb70f2869763ed1734524
[LV] Extend InstWidening with CM_Widen_Recursive

Changes to the original scalar loop during LV code gen cause the return value
of Legal->isConsecutivePtr() to be inconsistent with the return value during
legal/cost phases (further analysis and information of the bug is in D39346).
This patch is an alternative fix to PR34965 following the CM_Widen approach
proposed by Ayal and Gil in D39346. It extends InstWidening enum with
CM_Widen_Reverse to properly record the widening decision for consecutive
reverse memory accesses and, consequently, get rid of the
Legal->isConsetuviePtr() call in LV code gen. I think this is a simpler/cleaner
solution to PR34965 than the one in D39346.

Fixes PR34965.

Patch by Diego Caballero, thanks!

Differential Revision: https://reviews.llvm.org/D40742

llvm-svn: 320913
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/consecutive-ptr-cg-bug.ll [new file with mode: 0644]