[LV] Avoid emitting trivially dead instructions
authorMatthew Simpson <mssimpso@codeaurora.org>
Wed, 19 Oct 2016 19:22:02 +0000 (19:22 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Wed, 19 Oct 2016 19:22:02 +0000 (19:22 +0000)
commit41fa838f07c2cc456b16addb1703c0203e372047
tree58d908eab51399abe3a4a11806cbdac32b41530f
parent6e3a92ec880b3f7cd6048b74ef62f7a3ae2165fc
[LV] Avoid emitting trivially dead instructions

Some instructions from the original loop, when vectorized, can become trivially
dead. This happens because of the way we structure the new loop. For example,
we create new induction variables and induction variable "steps" in the new
loop. Thus, when we go to vectorize the original induction variable update, it
may no longer be needed due to the instructions we've already created. This
patch prevents us from creating these redundant instructions. This reduces code
size before simplification and allows greater flexibility in code generation
since we have fewer unnecessary instruction uses.

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

llvm-svn: 284631
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/dead_instructions.ll [new file with mode: 0644]