Merging r257875:
authorHans Wennborg <hans@hanshq.net>
Tue, 19 Jan 2016 20:49:25 +0000 (20:49 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 19 Jan 2016 20:49:25 +0000 (20:49 +0000)
commitf5575ecd57c4ab8cdae1a80fecc01029d14fe4e6
tree467f21840514d611751ca7eae86bda3ee6e00d58
parente12bf2aba135af15b33cca8a8c0fb80189a16b80
Merging r257875:
------------------------------------------------------------------------
r257875 | jamesm | 2016-01-15 01:20:19 -0800 (Fri, 15 Jan 2016) | 11 lines

[InstCombine] Rewrite bswap/bitreverse handling completely.

There are several requirements that ended up with this design;
  1. Matching bitreversals is too heavyweight for InstCombine and doesn't really need to be done so early.
  2. Bitreversals and byteswaps are very related in their matching logic.
  3. We want to implement support for matching more advanced bswap/bitreverse patterns like partial bswaps/bitreverses.
  4. Bswaps are best matched early in InstCombine.

The result of these is that a new utility function is created in Transforms/Utils/Local.h that can be configured to search for bswaps, bitreverses or both. InstCombine uses it to find only bswaps, CGP uses it to find only bitreversals.

We can then extend the matching logic in one place only.
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@258180 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/Utils/Local.h
lib/CodeGen/CodeGenPrepare.cpp
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
lib/Transforms/Utils/Local.cpp
test/Transforms/CodeGenPrepare/ARM/bitreverse-recognize.ll [new file with mode: 0644]
test/Transforms/CodeGenPrepare/ARM/lit.local.cfg [new file with mode: 0644]
test/Transforms/CodeGenPrepare/bitreverse-hang.ll [new file with mode: 0644]
test/Transforms/InstCombine/bitreverse-hang.ll [new file with mode: 0644]
test/Transforms/InstCombine/bitreverse-recognize.ll [deleted file]