forked from OSchip/llvm-project
[CallSite removal][Transform] Replace CallSite with CallBase in Utils. NFC
Differential Revision: https://reviews.llvm.org/D78780
This commit is contained in:
parent
6bffd0df78
commit
81c5e83f7d
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.");
|
||||
|
|
Loading…
Reference in New Issue