From 4f84764e321b1382a179911648c02a1a7f9d5d94 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Sat, 24 Dec 2016 17:14:19 +0000 Subject: [PATCH] [NewGVN] Simplify several equals() member functions. NFCI. llvm-svn: 290498 --- .../llvm/Transforms/Scalar/GVNExpression.h | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h index db67db8e6b6d..dd8a23ca83e9 100644 --- a/llvm/include/llvm/Transforms/Scalar/GVNExpression.h +++ b/llvm/include/llvm/Transforms/Scalar/GVNExpression.h @@ -189,13 +189,8 @@ public: return false; const auto &OE = cast(Other); - if (getType() != OE.getType()) - return false; - if (NumOperands != OE.NumOperands) - return false; - if (!std::equal(ops_begin(), ops_end(), OE.ops_begin())) - return false; - return true; + return getType() == OE.getType() && NumOperands == OE.NumOperands && + std::equal(ops_begin(), ops_end(), OE.ops_begin()); } virtual hash_code getHashValue() const override { @@ -399,11 +394,8 @@ public: if (!this->BasicExpression::equals(Other)) return false; const AggregateValueExpression &OE = cast(Other); - if (NumIntOperands != OE.NumIntOperands) - return false; - if (!std::equal(int_ops_begin(), int_ops_end(), OE.int_ops_begin())) - return false; - return true; + return NumIntOperands == OE.NumIntOperands && + std::equal(int_ops_begin(), int_ops_end(), OE.int_ops_begin()); } virtual hash_code getHashValue() const override { @@ -446,9 +438,7 @@ public: if (!this->BasicExpression::equals(Other)) return false; const PHIExpression &OE = cast(Other); - if (BB != OE.BB) - return false; - return true; + return BB == OE.BB; } virtual hash_code getHashValue() const override { @@ -485,9 +475,7 @@ public: void setVariableValue(Value *V) { VariableValue = V; } virtual bool equals(const Expression &Other) const override { const VariableExpression &OC = cast(Other); - if (VariableValue != OC.VariableValue) - return false; - return true; + return VariableValue == OC.VariableValue; } virtual hash_code getHashValue() const override {