Skip to content

Commit

Permalink
[CallSite removal][TargetLibraryInfo] Replace ImmutableCallSite with …
Browse files Browse the repository at this point in the history
…CallBase in one of the getLibFunc signatures. NFC

Differential Revision: https://reviews.llvm.org/D78083
  • Loading branch information
topperc committed Apr 16, 2020
1 parent 4213bc7 commit 8e14086
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions llvm/include/llvm/Analysis/TargetLibraryInfo.h
Expand Up @@ -13,8 +13,8 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Pass.h"
Expand Down Expand Up @@ -287,11 +287,11 @@ class TargetLibraryInfo {
return Impl->getLibFunc(FDecl, F);
}

/// If a callsite does not have the 'nobuiltin' attribute, return if the
/// If a callbase does not have the 'nobuiltin' attribute, return if the
/// called function is a known library function and set F to that function.
bool getLibFunc(ImmutableCallSite CS, LibFunc &F) const {
return !CS.isNoBuiltin() && CS.getCalledFunction() &&
getLibFunc(*(CS.getCalledFunction()), F);
bool getLibFunc(const CallBase &CB, LibFunc &F) const {
return !CB.isNoBuiltin() && CB.getCalledFunction() &&
getLibFunc(*(CB.getCalledFunction()), F);
}

/// Disables all builtins.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/ExpandMemCmp.cpp
Expand Up @@ -824,7 +824,7 @@ bool ExpandMemCmpPass::runOnBlock(
continue;
}
LibFunc Func;
if (TLI->getLibFunc(ImmutableCallSite(CI), Func) &&
if (TLI->getLibFunc(*CI, Func) &&
(Func == LibFunc_memcmp || Func == LibFunc_bcmp) &&
expandMemCmp(CI, TTI, TL, &DL, PSI, BFI)) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/Local.cpp
Expand Up @@ -2555,7 +2555,7 @@ bool llvm::callsGCLeafFunction(const CallBase *Call,
// marked as 'gc-leaf-function.' All available Libcalls are
// GC-leaf.
LibFunc LF;
if (TLI.getLibFunc(ImmutableCallSite(Call), LF)) {
if (TLI.getLibFunc(*Call, LF)) {
return TLI.has(LF);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
Expand Up @@ -1943,7 +1943,7 @@ Value *LibCallSimplifier::optimizeLog(CallInst *Log, IRBuilderBase &B) {

Intrinsic::ID ArgID = Arg->getIntrinsicID();
LibFunc ArgLb = NotLibFunc;
TLI->getLibFunc(Arg, ArgLb);
TLI->getLibFunc(*Arg, ArgLb);

// log(pow(x,y)) -> y*log(x)
if (ArgLb == PowLb || ArgID == Intrinsic::pow) {
Expand Down
1 change: 1 addition & 0 deletions llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
Expand Up @@ -12,6 +12,7 @@
#include "llvm/AsmParser/Parser.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
Expand Down

0 comments on commit 8e14086

Please sign in to comment.