diff options
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp index 2f64c655c08..c47ebb34087 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -964,7 +964,7 @@ Instruction *InstCombiner::foldAddWithConstant(BinaryOperator &Add) { if (!match(Op1, m_Constant(Op1C))) return nullptr; - if (Instruction *NV = foldOpWithConstantIntoOperand(Add)) + if (Instruction *NV = foldBinOpIntoSelectOrPhi(Add)) return NV; Value *X; @@ -1304,9 +1304,8 @@ Instruction *InstCombiner::visitFAdd(BinaryOperator &I) { SQ.getWithInstruction(&I))) return replaceInstUsesWith(I, V); - if (isa<Constant>(RHS)) - if (Instruction *FoldedFAdd = foldOpWithConstantIntoOperand(I)) - return FoldedFAdd; + if (Instruction *FoldedFAdd = foldBinOpIntoSelectOrPhi(I)) + return FoldedFAdd; // -A + B --> B - A if (Value *LHSV = dyn_castFNegVal(LHS)) |