[llvm] 81c5e83 - [CallSite removal][Transform] Replace CallSite with CallBase in Utils. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 20:49:56 PDT 2020
Author: Craig Topper
Date: 2020-04-23T20:49:33-07:00
New Revision: 81c5e83f7d3c42254ae5fecadd437475e28efe2f
URL: https://github.com/llvm/llvm-project/commit/81c5e83f7d3c42254ae5fecadd437475e28efe2f
DIFF: https://github.com/llvm/llvm-project/commit/81c5e83f7d3c42254ae5fecadd437475e28efe2f.diff
LOG: [CallSite removal][Transform] Replace CallSite with CallBase in Utils. NFC
Differential Revision: https://reviews.llvm.org/D78780
Added:
Modified:
llvm/lib/Transforms/Utils/GlobalStatus.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/LoopUnroll.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/GlobalStatus.cpp b/llvm/lib/Transforms/Utils/GlobalStatus.cpp
index a2942869130d..fe58f0e0fe40 100644
--- a/llvm/lib/Transforms/Utils/GlobalStatus.cpp
+++ b/llvm/lib/Transforms/Utils/GlobalStatus.cpp
@@ -9,7 +9,6 @@
#include "llvm/Transforms/Utils/GlobalStatus.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/IR/BasicBlock.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/GlobalValue.h"
@@ -164,8 +163,8 @@ static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS,
if (MSI->isVolatile())
return true;
GS.StoredType = GlobalStatus::Stored;
- } else if (auto C = ImmutableCallSite(I)) {
- if (!C.isCallee(&U))
+ } else if (const auto *CB = dyn_cast<CallBase>(I)) {
+ if (!CB->isCallee(&U))
return true;
GS.IsLoaded = true;
} else {
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b87cb0009113..dd5a57124ab3 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -41,7 +41,6 @@
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
@@ -2933,37 +2932,38 @@ bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
return true;
case Instruction::Call:
case Instruction::Invoke: {
- ImmutableCallSite CS(I);
+ const auto &CB = cast<CallBase>(*I);
// Can't handle inline asm. Skip it.
- if (CS.isInlineAsm())
+ if (CB.isInlineAsm())
return false;
// Constant bundle operands may need to retain their constant-ness for
// correctness.
- if (CS.isBundleOperand(OpIdx))
+ if (CB.isBundleOperand(OpIdx))
return false;
- if (OpIdx < CS.getNumArgOperands()) {
+ if (OpIdx < CB.getNumArgOperands()) {
// Some variadic intrinsics require constants in the variadic arguments,
// which currently aren't markable as immarg.
- if (CS.isIntrinsic() && OpIdx >= CS.getFunctionType()->getNumParams()) {
+ if (isa<IntrinsicInst>(CB) &&
+ OpIdx >= CB.getFunctionType()->getNumParams()) {
// This is known to be OK for stackmap.
- return CS.getIntrinsicID() == Intrinsic::experimental_stackmap;
+ return CB.getIntrinsicID() == Intrinsic::experimental_stackmap;
}
// gcroot is a special case, since it requires a constant argument which
// isn't also required to be a simple ConstantInt.
- if (CS.getIntrinsicID() == Intrinsic::gcroot)
+ if (CB.getIntrinsicID() == Intrinsic::gcroot)
return false;
// Some intrinsic operands are required to be immediates.
- return !CS.paramHasAttr(OpIdx, Attribute::ImmArg);
+ return !CB.paramHasAttr(OpIdx, Attribute::ImmArg);
}
// It is never allowed to replace the call argument to an intrinsic, but it
// may be possible for a call.
- return !CS.isIntrinsic();
+ return !isa<IntrinsicInst>(CB);
}
case Instruction::ShuffleVector:
// Shufflevector masks are constant.
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
index 5c8191b4ee5f..c0177bdb3f6f 100644
--- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -35,7 +35,6 @@
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
@@ -428,8 +427,8 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
bool HasConvergent = false;
for (auto &BB : L->blocks())
for (auto &I : *BB)
- if (auto CS = CallSite(&I))
- HasConvergent |= CS.isConvergent();
+ if (auto *CB = dyn_cast<CallBase>(&I))
+ HasConvergent |= CB->isConvergent();
assert((!HasConvergent || ULO.TripMultiple % ULO.Count == 0) &&
"Unroll count must divide trip multiple if loop contains a "
"convergent operation.");
More information about the llvm-commits
mailing list