OSDN Git Service

[LV] Fix PR34523 - avoid generating redundant selects
authorAyal Zaks <ayal.zaks@intel.com>
Wed, 13 Sep 2017 06:28:37 +0000 (06:28 +0000)
committerAyal Zaks <ayal.zaks@intel.com>
Wed, 13 Sep 2017 06:28:37 +0000 (06:28 +0000)
commit3c0fd8c54bac789e5481f466067c213f6af90182
tree6decf4b7238ab77c20285e8bacf316d4350e0871
parentf844eaced2fd24719e8ad752a85932df49547baf
[LV] Fix PR34523 - avoid generating redundant selects

When converting a PHI into a series of 'select' instructions to combine the
incoming values together according their edge masks, initialize the first
value to the incoming value In0 of the first predecessor, instead of
generating a redundant assignment 'select(Cond[0], In0, In0)'. The latter
fails when the Cond[0] mask is null, representing a full mask, which can
happen only when there's a single incoming value.

No functional changes intended nor expected other than surviving null Cond[0]'s.

This fix follows D35725, which introduced using null to represent full masks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313119 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/if-conversion.ll