[llvm] c95f398 - [Constant] Add tests for ConstantVector::get (NFC)

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 17:08:12 PST 2021


Author: Juneyoung Lee
Date: 2021-01-07T10:08:01+09:00
New Revision: c95f39891a282ebf36199c73b705d4a2c78a46ce

URL: https://github.com/llvm/llvm-project/commit/c95f39891a282ebf36199c73b705d4a2c78a46ce
DIFF: https://github.com/llvm/llvm-project/commit/c95f39891a282ebf36199c73b705d4a2c78a46ce.diff

LOG: [Constant] Add tests for ConstantVector::get (NFC)

Added: 
    

Modified: 
    llvm/unittests/IR/ConstantsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp
index afae154cca90..9eabc7c55638 100644
--- a/llvm/unittests/IR/ConstantsTest.cpp
+++ b/llvm/unittests/IR/ConstantsTest.cpp
@@ -631,9 +631,17 @@ TEST(ConstantsTest, isElementWiseEqual) {
 
   Type *Int32Ty = Type::getInt32Ty(Context);
   Constant *CU = UndefValue::get(Int32Ty);
+  Constant *CP = PoisonValue::get(Int32Ty);
   Constant *C1 = ConstantInt::get(Int32Ty, 1);
   Constant *C2 = ConstantInt::get(Int32Ty, 2);
 
+  Constant *CUU = ConstantVector::get({CU, CU});
+  Constant *CPP = ConstantVector::get({CP, CP});
+  Constant *CUP = ConstantVector::get({CU, CP});
+  EXPECT_EQ(CUU, UndefValue::get(CUU->getType()));
+  EXPECT_EQ(CPP, PoisonValue::get(CPP->getType()));
+  EXPECT_NE(CUP, UndefValue::get(CUP->getType()));
+
   Constant *C1211 = ConstantVector::get({C1, C2, C1, C1});
   Constant *C12U1 = ConstantVector::get({C1, C2, CU, C1});
   Constant *C12U2 = ConstantVector::get({C1, C2, CU, C2});


        


More information about the llvm-commits mailing list