From d269d5e5555a41bc4c798ff4a47a038505d759c3 Mon Sep 17 00:00:00 2001 From: Juneyoung Lee Date: Thu, 7 Jan 2021 10:08:01 +0900 Subject: [PATCH] [Constant] Add tests for ConstantVector::get (NFC) --- unittests/IR/ConstantsTest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unittests/IR/ConstantsTest.cpp b/unittests/IR/ConstantsTest.cpp index afae154cca9..9eabc7c5563 100644 --- a/unittests/IR/ConstantsTest.cpp +++ b/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});