OSDN Git Service

[InstCombine] Don't let folding (select (icmp eq (and X, C1), 0), Y, (or Y, C2))...
authorCraig Topper <craig.topper@intel.com>
Wed, 21 Jun 2017 16:07:13 +0000 (16:07 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 21 Jun 2017 16:07:13 +0000 (16:07 +0000)
commitf2fe26d60eb81a699f2d565e8baabcaf32f9c5ea
tree88a861c1f586688b7bf873b5c99443e7fe489165
parente44557f01940117afe0fc2d56a0686c3646147a0
[InstCombine] Don't let folding (select (icmp eq (and X, C1), 0), Y, (or Y, C2)) create more instructions than it removes

Summary:
Previously this folding had no checks to see if it was going to result in less instructions. This was pointed out during the review of D34184

This patch adds code to count how many instructions its going to create vs how many its going to remove so we can make a proper decision.

Reviewers: spatel, majnemer

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305926 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/select-with-bitwise-ops.ll