summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-03-26 14:25:43 +0000
committerSanjay Patel <spatel@rotateright.com>2018-03-26 14:25:43 +0000
commit2455fef497a09cf358daf43ea910eb5a23542980 (patch)
tree0fdae7187c3cba3d0ba732ad96908e62921b7814 /llvm/lib/Transforms
parent67df1cf597974fdd0ec8828688e89acfc5862c49 (diff)
downloadbcm5719-llvm-2455fef497a09cf358daf43ea910eb5a23542980.tar.gz
bcm5719-llvm-2455fef497a09cf358daf43ea910eb5a23542980.zip
[InstCombine] check uses before creating instructions for fmul distribution
As the tests show, we could create extra instructions without any obvious benefit. llvm-svn: 328498
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index f35311bb966..99350c538da 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -581,7 +581,7 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
// X * C, C/X, X/C, where C is a constant.
// (MDC +/- C1) * C => (MDC * C) +/- (C1 * C)
Instruction *FAddSub = dyn_cast<Instruction>(Op0);
- if (FAddSub &&
+ if (FAddSub && FAddSub->hasOneUse() &&
(FAddSub->getOpcode() == Instruction::FAdd ||
FAddSub->getOpcode() == Instruction::FSub)) {
Value *Opnd0 = FAddSub->getOperand(0);
OpenPOWER on IntegriCloud