diff options
| author | James Y Knight <jyknight@google.com> | 2019-02-01 20:43:25 +0000 |
|---|---|---|
| committer | James Y Knight <jyknight@google.com> | 2019-02-01 20:43:25 +0000 |
| commit | 7976eb58382b25d0e17490b9d77fb06cb000c95b (patch) | |
| tree | 286450abb61ef79d2e7356e0d0d80dbbce0a728a /llvm/unittests | |
| parent | c456309f67a9ea44038fb5d8a96c90d9c6965b67 (diff) | |
| download | bcm5719-llvm-7976eb58382b25d0e17490b9d77fb06cb000c95b.tar.gz bcm5719-llvm-7976eb58382b25d0e17490b9d77fb06cb000c95b.zip | |
[opaque pointer types] Pass function types to CallInst creation.
This cleans up all CallInst creation in LLVM to explicitly pass a
function type rather than deriving it from the pointer's element-type.
Differential Revision: https://reviews.llvm.org/D57170
llvm-svn: 352909
Diffstat (limited to 'llvm/unittests')
| -rw-r--r-- | llvm/unittests/IR/BasicBlockTest.cpp | 7 | ||||
| -rw-r--r-- | llvm/unittests/IR/IRBuilderTest.cpp | 2 | ||||
| -rw-r--r-- | llvm/unittests/IR/InstructionsTest.cpp | 9 |
3 files changed, 9 insertions, 9 deletions
diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp index bb5f1353c20..95bc242ec30 100644 --- a/llvm/unittests/IR/BasicBlockTest.cpp +++ b/llvm/unittests/IR/BasicBlockTest.cpp @@ -100,10 +100,9 @@ TEST(BasicBlockTest, TestInstructionsWithoutDebug) { Argument *V = new Argument(Type::getInt32Ty(Ctx)); Function *F = Function::Create(FT, Function::ExternalLinkage, "", M); - Value *DbgAddr = Intrinsic::getDeclaration(M, Intrinsic::dbg_addr); - Value *DbgDeclare = - Intrinsic::getDeclaration(M, Intrinsic::dbg_declare); - Value *DbgValue = Intrinsic::getDeclaration(M, Intrinsic::dbg_value); + Function *DbgAddr = Intrinsic::getDeclaration(M, Intrinsic::dbg_addr); + Function *DbgDeclare = Intrinsic::getDeclaration(M, Intrinsic::dbg_declare); + Function *DbgValue = Intrinsic::getDeclaration(M, Intrinsic::dbg_value); Value *DIV = MetadataAsValue::get(Ctx, (Metadata *)nullptr); SmallVector<Value *, 3> Args = {DIV, DIV, DIV}; diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index baf982f94fc..a20e495c873 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -353,7 +353,7 @@ TEST_F(IRBuilderTest, FastMathFlags) { FCall = Builder.CreateCall(Callee, None); EXPECT_FALSE(FCall->hasNoNaNs()); - Value *V = + Function *V = Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get()); FCall = Builder.CreateCall(V, None); EXPECT_FALSE(FCall->hasNoNaNs()); diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp index a28ba7a2e20..1f82d4b632c 100644 --- a/llvm/unittests/IR/InstructionsTest.cpp +++ b/llvm/unittests/IR/InstructionsTest.cpp @@ -504,14 +504,15 @@ TEST(InstructionsTest, CloneCall) { LLVMContext C; Type *Int32Ty = Type::getInt32Ty(C); Type *ArgTys[] = {Int32Ty, Int32Ty, Int32Ty}; - Type *FnTy = FunctionType::get(Int32Ty, ArgTys, /*isVarArg=*/false); + FunctionType *FnTy = FunctionType::get(Int32Ty, ArgTys, /*isVarArg=*/false); Value *Callee = Constant::getNullValue(FnTy->getPointerTo()); Value *Args[] = { ConstantInt::get(Int32Ty, 1), ConstantInt::get(Int32Ty, 2), ConstantInt::get(Int32Ty, 3) }; - std::unique_ptr<CallInst> Call(CallInst::Create(Callee, Args, "result")); + std::unique_ptr<CallInst> Call( + CallInst::Create(FnTy, Callee, Args, "result")); // Test cloning the tail call kind. CallInst::TailCallKind Kinds[] = {CallInst::TCK_None, CallInst::TCK_Tail, @@ -537,12 +538,12 @@ TEST(InstructionsTest, CloneCall) { TEST(InstructionsTest, AlterCallBundles) { LLVMContext C; Type *Int32Ty = Type::getInt32Ty(C); - Type *FnTy = FunctionType::get(Int32Ty, Int32Ty, /*isVarArg=*/false); + FunctionType *FnTy = FunctionType::get(Int32Ty, Int32Ty, /*isVarArg=*/false); Value *Callee = Constant::getNullValue(FnTy->getPointerTo()); Value *Args[] = {ConstantInt::get(Int32Ty, 42)}; OperandBundleDef OldBundle("before", UndefValue::get(Int32Ty)); std::unique_ptr<CallInst> Call( - CallInst::Create(Callee, Args, OldBundle, "result")); + CallInst::Create(FnTy, Callee, Args, OldBundle, "result")); Call->setTailCallKind(CallInst::TailCallKind::TCK_NoTail); AttrBuilder AB; AB.addAttribute(Attribute::Cold); |

