summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 18cd0000f98..9046c36dee8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -327,12 +327,14 @@ static bool canNotEvaluateInType(Value *V, Type *Ty) {
if (!isa<Instruction>(V))
return true;
// We can't extend or shrink something that has multiple uses -- unless those
- // multiple uses are all in the same instruction -- doing so would require
- // duplicating the instruction which isn't profitable.
- if (!V->hasOneUse())
+ // multiple uses are all in the same binop instruction -- doing so would
+ // require duplicating the instruction which isn't profitable.
+ if (!V->hasOneUse()) {
+ if (!match(V->user_back(), m_BinOp()))
+ return true;
if (any_of(V->users(), [&](User *U) { return U != V->user_back(); }))
return true;
-
+ }
return false;
}
OpenPOWER on IntegriCloud