OSDN Git Service

LoopVectorizer: Recognize min/max reductions
authorArnold Schwaighofer <aschwaighofer@apple.com>
Thu, 18 Apr 2013 17:22:34 +0000 (17:22 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Thu, 18 Apr 2013 17:22:34 +0000 (17:22 +0000)
commita3fb330d05e85107d01ecf133355d0c6a88196fd
treebb72c5b84952d2c0a48de9bb27b8637979329384
parentbff177676c32b88e19b8230cf048b5d7bdc7d657
LoopVectorizer: Recognize min/max reductions

A min/max operation is represented by a select(cmp(lt/le/gt/ge, X, Y), X, Y)
sequence in LLVM. If we see such a sequence we can treat it just as any other
commutative binary instruction and reduce it.

This appears to help bzip2 by about 1.5% on an imac12,2.

radar://12960601

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