summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Bougacha <ahmed.bougacha@gmail.com>2016-07-29 16:11:04 +0000
committerAhmed Bougacha <ahmed.bougacha@gmail.com>2016-07-29 16:11:04 +0000
commit9d95557128642db9825596e501b4d4656d935f9b (patch)
tree4c02dd091a7b4ce559dcb41c0be5c54a4c19d4f3
parent8292bdf73551c66ce2b9f22629c1a06628b5f777 (diff)
downloadbcm5719-llvm-9d95557128642db9825596e501b4d4656d935f9b.tar.gz
bcm5719-llvm-9d95557128642db9825596e501b4d4656d935f9b.zip
[GlobalISel] Add LLT::operator!=().
llvm-svn: 277162
-rw-r--r--llvm/include/llvm/CodeGen/LowLevelType.h4
-rw-r--r--llvm/unittests/CodeGen/LowLevelTypeTest.cpp13
2 files changed, 16 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/LowLevelType.h b/llvm/include/llvm/CodeGen/LowLevelType.h
index 7d975704495..a6597f19ccb 100644
--- a/llvm/include/llvm/CodeGen/LowLevelType.h
+++ b/llvm/include/llvm/CodeGen/LowLevelType.h
@@ -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;
diff --git a/llvm/unittests/CodeGen/LowLevelTypeTest.cpp b/llvm/unittests/CodeGen/LowLevelTypeTest.cpp
index e1161cb4662..79e66ecd23d 100644
--- a/llvm/unittests/CodeGen/LowLevelTypeTest.cpp
+++ b/llvm/unittests/CodeGen/LowLevelTypeTest.cpp
@@ -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);
OpenPOWER on IntegriCloud