[llvm] r277162 - [GlobalISel] Add LLT::operator!=().
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 29 09:11:05 PDT 2016
Author: ab
Date: Fri Jul 29 11:11:04 2016
New Revision: 277162
URL: http://llvm.org/viewvc/llvm-project?rev=277162&view=rev
Log:
[GlobalISel] Add LLT::operator!=().
Modified:
llvm/trunk/include/llvm/CodeGen/LowLevelType.h
llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LowLevelType.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LowLevelType.h?rev=277162&r1=277161&r2=277162&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LowLevelType.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LowLevelType.h Fri Jul 29 11:11:04 2016
@@ -169,11 +169,13 @@ public:
void print(raw_ostream &OS) const;
- bool operator ==(const LLT &RHS) const {
+ bool operator==(const LLT &RHS) const {
return Kind == RHS.Kind && SizeOrAddrSpace == RHS.SizeOrAddrSpace &&
NumElements == RHS.NumElements;
}
+ bool operator!=(const LLT &RHS) const { return !(*this == RHS); }
+
friend struct DenseMapInfo<LLT>;
private:
unsigned SizeOrAddrSpace;
Modified: llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp?rev=277162&r1=277161&r2=277162&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/LowLevelTypeTest.cpp Fri Jul 29 11:11:04 2016
@@ -60,6 +60,9 @@ TEST(LowLevelTypeTest, Scalar) {
// Test equality operators.
EXPECT_TRUE(Ty == Ty);
+ EXPECT_FALSE(Ty != Ty);
+
+ EXPECT_NE(Ty, DoubleTy);
// Test Type->LLT conversion.
const Type *IRTy = IntegerType::get(C, S);
@@ -141,6 +144,15 @@ TEST(LowLevelTypeTest, Vector) {
// Test equality operators.
EXPECT_TRUE(VTy == VTy);
+ EXPECT_FALSE(VTy != VTy);
+
+ // Test inequality operators on..
+ // ..different kind.
+ EXPECT_NE(VTy, STy);
+ // ..different #elts.
+ EXPECT_NE(VTy, DoubleEltTy);
+ // ..different scalar size.
+ EXPECT_NE(VTy, DoubleSzTy);
// Test Type->LLT conversion.
Type *IRSTy = IntegerType::get(C, S);
@@ -169,6 +181,7 @@ TEST(LowLevelTypeTest, Pointer) {
// Test equality operators.
EXPECT_TRUE(Ty == Ty);
+ EXPECT_FALSE(Ty != Ty);
// Test Type->LLT conversion.
const Type *IRTy = PointerType::get(IntegerType::get(C, 8), AS);
More information about the llvm-commits
mailing list