summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2011-07-04 20:16:36 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2011-07-04 20:16:36 +0000
commit9eca5feff1fc77a914ca6b1a4daabcbc72b98f01 (patch)
treeecd1dfe80ce932b127bb7e79b02229efd105ff59 /llvm/lib
parent1052fd76ab1a9dd8f6568021e51e859170b616e5 (diff)
downloadbcm5719-llvm-9eca5feff1fc77a914ca6b1a4daabcbc72b98f01.tar.gz
bcm5719-llvm-9eca5feff1fc77a914ca6b1a4daabcbc72b98f01.zip
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. llvm-svn: 134379
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 42db444ff6d..5a1e2b08853 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud