]> granicus.if.org Git - llvm/commit
[InstCombine] Add single use checks to SimplifyBSwap to ensure we are really saving...
authorCraig Topper <craig.topper@intel.com>
Thu, 6 Jul 2017 16:24:21 +0000 (16:24 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 6 Jul 2017 16:24:21 +0000 (16:24 +0000)
commitafbb3e0e902d92946d69d216dbbbe27de056df09
treedafeb3720be497f01542f9e9a11fd75944ef9799
parenteebcffd281094d9c48a4681ac1bd8cbdb22dfd95
[InstCombine] Add single use checks to SimplifyBSwap to ensure we are really saving instructions

Bswap isn't a simple operation so we need to make sure we are really removing a call to it before doing these simplifications.

For the case when both LHS and RHS are bswaps I've allowed it to be moved if either LHS or RHS has a single use since that at least allows us to move it later where it might find another bswap to combine with and it decreases the use count on the other side so maybe the other user can be optimized.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307273 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/bswap-fold.ll