forked from OSchip/llvm-project
[MemoryBuiltins] Use ImmutableCallSite instead of CallSite to remove a const_cast and const correct. NFCI
llvm-svn: 300585
This commit is contained in:
parent
9d0042b47c
commit
eae6db0e5c
|
@ -77,8 +77,8 @@ static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = {
|
||||||
// TODO: Handle "int posix_memalign(void **, size_t, size_t)"
|
// TODO: Handle "int posix_memalign(void **, size_t, size_t)"
|
||||||
};
|
};
|
||||||
|
|
||||||
static Function *getCalledFunction(const Value *V, bool LookThroughBitCast,
|
static const Function *getCalledFunction(const Value *V, bool LookThroughBitCast,
|
||||||
bool &IsNoBuiltin) {
|
bool &IsNoBuiltin) {
|
||||||
// Don't care about intrinsics in this case.
|
// Don't care about intrinsics in this case.
|
||||||
if (isa<IntrinsicInst>(V))
|
if (isa<IntrinsicInst>(V))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -86,13 +86,13 @@ static Function *getCalledFunction(const Value *V, bool LookThroughBitCast,
|
||||||
if (LookThroughBitCast)
|
if (LookThroughBitCast)
|
||||||
V = V->stripPointerCasts();
|
V = V->stripPointerCasts();
|
||||||
|
|
||||||
CallSite CS(const_cast<Value*>(V));
|
ImmutableCallSite CS(V);
|
||||||
if (!CS.getInstruction())
|
if (!CS.getInstruction())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
IsNoBuiltin = CS.isNoBuiltin();
|
IsNoBuiltin = CS.isNoBuiltin();
|
||||||
|
|
||||||
Function *Callee = CS.getCalledFunction();
|
const Function *Callee = CS.getCalledFunction();
|
||||||
if (!Callee || !Callee->isDeclaration())
|
if (!Callee || !Callee->isDeclaration())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return Callee;
|
return Callee;
|
||||||
|
|
Loading…
Reference in New Issue