[LV] Use correct insertion point when type shrinking reductions
authorMatthew Simpson <mssimpso@codeaurora.org>
Fri, 29 Sep 2017 18:07:39 +0000 (18:07 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Fri, 29 Sep 2017 18:07:39 +0000 (18:07 +0000)
commitf4bb480b623d967dc3acd8c9b516b75b1cf0dfef
tree3894cd33f699bf894f04ffdeabd05ad3cd50c387
parentc75a087c7a9beee1e0c23edf4c6ba173524c4773
[LV] Use correct insertion point when type shrinking reductions

When type shrinking reductions, we should insert the truncations and extends at
the end of the loop latch block. Previously, these instructions were inserted
at the end of the loop header block. The difference is only a problem for loops
with predicated instructions (e.g., conditional stores and instructions that
may divide by zero). For these instructions, we create new basic blocks inside
the vectorized loop, which cause the loop header and latch to no longer be the
same block. This should fix PR34687.

Reference: https://bugs.llvm.org/show_bug.cgi?id=34687
llvm-svn: 314542
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/reduction-small-size.ll [new file with mode: 0644]