]> granicus.if.org Git - llvm/commit
[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)
commite0d97dea2f357daa9c052a91bfb5c0248cf901eb
treed2044bef84102c09471f62aa2ae2e7a6d0ee6c67
parentafe863129f5d3a40bc2bdb30cdab47ccf07b813d
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314542 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/reduction-small-size.ll [new file with mode: 0644]