diff options
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/IR/Module.cpp | 13 |
3 files changed, 14 insertions, 14 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 574ca88e1c9..6af0589f9cc 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1018,10 +1018,9 @@ bool Intrinsic::isLeaf(ID id) { Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) { // There can never be multiple globals with the same name of different types, // because intrinsics must be a specific type. - return cast<Function>( - M->getOrInsertFunction(getName(id, Tys), - getType(M->getContext(), id, Tys)) - .getCallee()); + return + cast<Function>(M->getOrInsertFunction(getName(id, Tys), + getType(M->getContext(), id, Tys))); } // This defines the "Intrinsic::getIntrinsicForGCCBuiltin()" method. diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 4819d5f7b7d..6c7817adc6a 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -517,7 +517,7 @@ static Instruction *createMalloc(Instruction *InsertBefore, BasicBlock *BB = InsertBefore ? InsertBefore->getParent() : InsertAtEnd; Module *M = BB->getParent()->getParent(); Type *BPTy = Type::getInt8PtrTy(BB->getContext()); - FunctionCallee MallocFunc = MallocF; + Value *MallocFunc = MallocF; if (!MallocFunc) // prototype malloc as "void *malloc(size_t)" MallocFunc = M->getOrInsertFunction("malloc", BPTy, IntPtrTy); @@ -541,7 +541,7 @@ static Instruction *createMalloc(Instruction *InsertBefore, } } MCall->setTailCall(); - if (Function *F = dyn_cast<Function>(MallocFunc.getCallee())) { + if (Function *F = dyn_cast<Function>(MallocFunc)) { MCall->setCallingConv(F->getCallingConv()); if (!F->returnDoesNotAlias()) F->setReturnDoesNotAlias(); @@ -614,7 +614,7 @@ static Instruction *createFree(Value *Source, Type *VoidTy = Type::getVoidTy(M->getContext()); Type *IntPtrTy = Type::getInt8PtrTy(M->getContext()); // prototype free as "void free(void*)" - FunctionCallee FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy); + Value *FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy); CallInst *Result = nullptr; Value *PtrCast = Source; if (InsertBefore) { @@ -627,7 +627,7 @@ static Instruction *createFree(Value *Source, Result = CallInst::Create(FreeFunc, PtrCast, Bundles, ""); } Result->setTailCall(); - if (Function *F = dyn_cast<Function>(FreeFunc.getCallee())) + if (Function *F = dyn_cast<Function>(FreeFunc)) Result->setCallingConv(F->getCallingConv()); return Result; diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index b6dd7ab70a8..fd6495f4dbd 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -140,8 +140,8 @@ void Module::getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const { // it. This is nice because it allows most passes to get away with not handling // the symbol table directly for this common task. // -FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty, - AttributeList AttributeList) { +Constant *Module::getOrInsertFunction(StringRef Name, FunctionType *Ty, + AttributeList AttributeList) { // See if we have a definition for the specified function already. GlobalValue *F = getNamedValue(Name); if (!F) { @@ -151,20 +151,21 @@ FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty, if (!New->isIntrinsic()) // Intrinsics get attrs set on construction New->setAttributes(AttributeList); FunctionList.push_back(New); - return {Ty, New}; // Return the new prototype. + return New; // Return the new prototype. } // If the function exists but has the wrong type, return a bitcast to the // right type. auto *PTy = PointerType::get(Ty, F->getAddressSpace()); if (F->getType() != PTy) - return {Ty, ConstantExpr::getBitCast(F, PTy)}; + return ConstantExpr::getBitCast(F, PTy); // Otherwise, we just found the existing function or a prototype. - return {Ty, F}; + return F; } -FunctionCallee Module::getOrInsertFunction(StringRef Name, FunctionType *Ty) { +Constant *Module::getOrInsertFunction(StringRef Name, + FunctionType *Ty) { return getOrInsertFunction(Name, Ty, AttributeList()); } |