summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-05-03 05:48:49 +0000
committerCraig Topper <craig.topper@intel.com>2018-05-03 05:48:49 +0000
commit856fd686908aac7edb37f1013874cb79c84de5bc (patch)
tree1c1e08c22c2e6ad5456d83bbf2caa837f0e74c3f /llvm/lib/Transforms
parenta0cba89f861da4cba80c28a1d3cf30c8e0fb436e (diff)
downloadbcm5719-llvm-856fd686908aac7edb37f1013874cb79c84de5bc.tar.gz
bcm5719-llvm-856fd686908aac7edb37f1013874cb79c84de5bc.zip
[LoopIdiomRecognize] When looking for 'x & (x -1)' for popcnt, make sure the left hand side of the 'and' matches the left hand side of the 'subtract'
llvm-svn: 331437
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index fc64058fd4a..59753579bc3 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1196,7 +1196,7 @@ static bool detectPopcountIdiom(Loop *CurLoop, BasicBlock *PreCondBB,
VarX1 = DefX2->getOperand(0);
SubOneOp = dyn_cast<BinaryOperator>(DefX2->getOperand(1));
}
- if (!SubOneOp)
+ if (!SubOneOp || SubOneOp->getOperand(0) != VarX1)
return false;
ConstantInt *Dec = dyn_cast<ConstantInt>(SubOneOp->getOperand(1));
OpenPOWER on IntegriCloud