diff options
Diffstat (limited to 'llvm/unittests/IR/ConstantsTest.cpp')
-rw-r--r-- | llvm/unittests/IR/ConstantsTest.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp index 6c3497a6c84..4a8fcaa48e3 100644 --- a/llvm/unittests/IR/ConstantsTest.cpp +++ b/llvm/unittests/IR/ConstantsTest.cpp @@ -476,13 +476,15 @@ TEST(ConstantsTest, BitcastToGEP) { } bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule, - uint64_t AndValue, unsigned FunctionAlign = 0) { + uint64_t AndValue, + MaybeAlign FunctionAlign = llvm::None) { Type *VoidType(Type::getVoidTy(Context)); FunctionType *FuncType(FunctionType::get(VoidType, false)); Function *Func(Function::Create( FuncType, GlobalValue::ExternalLinkage, "", TheModule)); - if (FunctionAlign) Func->setAlignment(FunctionAlign); + if (FunctionAlign) + Func->setAlignment(*FunctionAlign); IntegerType *ConstantIntType(Type::getInt32Ty(Context)); ConstantInt *TheConstant(ConstantInt::get(ConstantIntType, AndValue)); @@ -547,21 +549,21 @@ TEST(ConstantsTest, FoldFunctionAlign4PtrAlignMultiple) { LLVMContext Context; Module TheModule("TestModule", Context); TheModule.setDataLayout("Fn8"); - ASSERT_TRUE(foldFuncPtrAndConstToNull(Context, &TheModule, 2, 4)); + ASSERT_TRUE(foldFuncPtrAndConstToNull(Context, &TheModule, 2, Align(4))); } TEST(ConstantsTest, DontFoldFunctionAlign4PtrAlignIndependent) { LLVMContext Context; Module TheModule("TestModule", Context); TheModule.setDataLayout("Fi8"); - ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, &TheModule, 2, 4)); + ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, &TheModule, 2, Align(4))); } TEST(ConstantsTest, DontFoldFunctionPtrIfNoModule) { LLVMContext Context; // Even though the function is explicitly 4 byte aligned, in the absence of a // DataLayout we can't assume that the function pointer is aligned. - ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, nullptr, 2, 4)); + ASSERT_FALSE(foldFuncPtrAndConstToNull(Context, nullptr, 2, Align(4))); } TEST(ConstantsTest, FoldGlobalVariablePtr) { @@ -572,7 +574,7 @@ TEST(ConstantsTest, FoldGlobalVariablePtr) { std::unique_ptr<GlobalVariable> Global( new GlobalVariable(IntType, true, GlobalValue::ExternalLinkage)); - Global->setAlignment(4); + Global->setAlignment(Align(4)); ConstantInt *TheConstant(ConstantInt::get(IntType, 2)); |