[llvm] r290498 - [NewGVN] Simplify several equals() member functions. NFCI.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 24 09:14:20 PST 2016
Author: davide
Date: Sat Dec 24 11:14:19 2016
New Revision: 290498
URL: http://llvm.org/viewvc/llvm-project?rev=290498&view=rev
Log:
[NewGVN] Simplify several equals() member functions. NFCI.
Modified:
llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h
Modified: llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h?rev=290498&r1=290497&r2=290498&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h (original)
+++ llvm/trunk/include/llvm/Transforms/Scalar/GVNExpression.h Sat Dec 24 11:14:19 2016
@@ -189,13 +189,8 @@ public:
return false;
const auto &OE = cast<BasicExpression>(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<AggregateValueExpression>(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<PHIExpression>(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<VariableExpression>(Other);
- if (VariableValue != OC.VariableValue)
- return false;
- return true;
+ return VariableValue == OC.VariableValue;
}
virtual hash_code getHashValue() const override {
More information about the llvm-commits
mailing list