diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-07-04 20:16:36 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-07-04 20:16:36 +0000 |
commit | fc87cdc1f4df357167a7cef91af92b5012934124 (patch) | |
tree | 202492e0fb2166571cb63de740d776f33a2e63a3 /lib | |
parent | cbb11869c47bdf8f3fa540dc0ee44075c0da8598 (diff) | |
download | external_llvm-fc87cdc1f4df357167a7cef91af92b5012934124.zip external_llvm-fc87cdc1f4df357167a7cef91af92b5012934124.tar.gz external_llvm-fc87cdc1f4df357167a7cef91af92b5012934124.tar.bz2 |
PR10267: Don't combine an equality compare with an AND into an inequality compare when the AND has more than one use.
This can pessimize code, inequalities are generally more expensive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCompares.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp index 42db444..5a1e2b0 100644 --- a/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1454,7 +1454,11 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_NE, LHSI, Constant::getNullValue(RHS->getType())); - + + // Don't perform the following transforms if the AND has multiple uses + if (!BO->hasOneUse()) + break; + // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 if (BOC->getValue().isSignBit()) { Value *X = BO->getOperand(0); |