summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-11-15 16:19:17 +0000
committerSanjay Patel <spatel@rotateright.com>2017-11-15 16:19:17 +0000
commitb7ba7dffa6e9b6bb1dac37d9a1776e12e84df014 (patch)
tree52eb533243d08b65f0861d8d5104423d17eb40e2
parent7e8bb4787f8787661beb55a6d8f220dfbf13cf9f (diff)
[Reassociate] simplify code; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318298 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 2a69c418934..dcaa4034081 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -798,12 +798,9 @@ void ReassociatePass::RewriteExprTree(BinaryOperator *I,
/// additional opportunities have been exposed.
static Value *NegateValue(Value *V, Instruction *BI,
SetVector<AssertingVH<Instruction>> &ToRedo) {
- if (Constant *C = dyn_cast<Constant>(V)) {
- if (C->getType()->isFPOrFPVectorTy()) {
- return ConstantExpr::getFNeg(C);
- }
- return ConstantExpr::getNeg(C);
- }
+ if (auto *C = dyn_cast<Constant>(V))
+ return C->getType()->isFPOrFPVectorTy() ? ConstantExpr::getFNeg(C) :
+ ConstantExpr::getNeg(C);
// We are trying to expose opportunity for reassociation. One of the things
// that we want to do to achieve this is to push a negation as deep into an