]> granicus.if.org Git - llvm/commit
[LV] Fix PR34711 - widen instruction ranges when sinking casts
authorAyal Zaks <ayal.zaks@intel.com>
Thu, 5 Oct 2017 12:41:49 +0000 (12:41 +0000)
committerAyal Zaks <ayal.zaks@intel.com>
Thu, 5 Oct 2017 12:41:49 +0000 (12:41 +0000)
commit0e8a63e67fb85d78c63756f7846d59b2368482bf
treee3f61c5e21d4afac2b9d45892128c2d97684bb27
parentf7ceddc7e61d486863a6bf9ddcf74bb87fd1b977
[LV] Fix PR34711 - widen instruction ranges when sinking casts

Instead of trying to keep LastWidenRecipe updated after creating each recipe,
have tryToWiden() retrieve the last recipe of the current VPBasicBlock and check
if it's a VPWidenRecipe when attempting to extend its range. This ensures that
such extensions, optimized to maintain the original instruction order, do so
only when the instructions are to maintain their relative order. The latter does
not always hold, e.g., when a cast needs to sink to unravel first order
recurrence (r306884).

Testcase derived from reproducer of PR34711.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314981 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/first-order-recurrence.ll