summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-02-28 16:50:51 +0000
committerSanjay Patel <spatel@rotateright.com>2018-02-28 16:50:51 +0000
commitb3f4f626987ccd9e680394af8b2d605a4a053ada (patch)
treeccb3283dc8270d5ab65f2cd183811fa193a2c8a9 /llvm/lib
parent8fdd87f9292cdd2419f3f10b3d8c12bcef5aee36 (diff)
downloadbcm5719-llvm-b3f4f626987ccd9e680394af8b2d605a4a053ada.tar.gz
bcm5719-llvm-b3f4f626987ccd9e680394af8b2d605a4a053ada.zip
[InstCombine] move invariant call out of loop; NFC
We really shouldn't need a 2-loop here at all, but that's another cleanup. llvm-svn: 326330
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index bd319ef83df..f79e33fe597 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -669,14 +669,14 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
if (match(Op1, m_OneUse(m_FNeg(m_Value(X)))))
return BinaryOperator::CreateFNegFMF(Builder.CreateFMulFMF(X, Op0, &I), &I);
+ // (select A, B, C) * (select A, D, E) --> select A, (B*D), (C*E)
+ if (Value *V = SimplifySelectsFeedingBinaryOp(I, Op0, Op1))
+ return replaceInstUsesWith(I, V);
+
// Handle symmetric situation in a 2-iteration loop
Value *Opnd0 = Op0;
Value *Opnd1 = Op1;
for (int i = 0; i < 2; i++) {
- // Handle specials cases for FMul with selects feeding the operation
- if (Value *V = SimplifySelectsFeedingBinaryOp(I, Op0, Op1))
- return replaceInstUsesWith(I, V);
-
// (X*Y) * X => (X*X) * Y where Y != X
// The purpose is two-fold:
// 1) to form a power expression (of X).
OpenPOWER on IntegriCloud