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/Transforms/Utils/GlobalStatus.h"
|
||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
#include "llvm/IR/BasicBlock.h"
|
#include "llvm/IR/BasicBlock.h"
|
||||||
#include "llvm/IR/CallSite.h"
|
|
||||||
#include "llvm/IR/Constant.h"
|
#include "llvm/IR/Constant.h"
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/GlobalValue.h"
|
#include "llvm/IR/GlobalValue.h"
|
||||||
|
@ -164,8 +163,8 @@ static bool analyzeGlobalAux(const Value *V, GlobalStatus &GS,
|
||||||
if (MSI->isVolatile())
|
if (MSI->isVolatile())
|
||||||
return true;
|
return true;
|
||||||
GS.StoredType = GlobalStatus::Stored;
|
GS.StoredType = GlobalStatus::Stored;
|
||||||
} else if (auto C = ImmutableCallSite(I)) {
|
} else if (const auto *CB = dyn_cast<CallBase>(I)) {
|
||||||
if (!C.isCallee(&U))
|
if (!CB->isCallee(&U))
|
||||||
return true;
|
return true;
|
||||||
GS.IsLoaded = true;
|
GS.IsLoaded = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "llvm/IR/Attributes.h"
|
#include "llvm/IR/Attributes.h"
|
||||||
#include "llvm/IR/BasicBlock.h"
|
#include "llvm/IR/BasicBlock.h"
|
||||||
#include "llvm/IR/CFG.h"
|
#include "llvm/IR/CFG.h"
|
||||||
#include "llvm/IR/CallSite.h"
|
|
||||||
#include "llvm/IR/Constant.h"
|
#include "llvm/IR/Constant.h"
|
||||||
#include "llvm/IR/ConstantRange.h"
|
#include "llvm/IR/ConstantRange.h"
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
|
@ -2933,37 +2932,38 @@ bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
|
||||||
return true;
|
return true;
|
||||||
case Instruction::Call:
|
case Instruction::Call:
|
||||||
case Instruction::Invoke: {
|
case Instruction::Invoke: {
|
||||||
ImmutableCallSite CS(I);
|
const auto &CB = cast<CallBase>(*I);
|
||||||
|
|
||||||
// Can't handle inline asm. Skip it.
|
// Can't handle inline asm. Skip it.
|
||||||
if (CS.isInlineAsm())
|
if (CB.isInlineAsm())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Constant bundle operands may need to retain their constant-ness for
|
// Constant bundle operands may need to retain their constant-ness for
|
||||||
// correctness.
|
// correctness.
|
||||||
if (CS.isBundleOperand(OpIdx))
|
if (CB.isBundleOperand(OpIdx))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (OpIdx < CS.getNumArgOperands()) {
|
if (OpIdx < CB.getNumArgOperands()) {
|
||||||
// Some variadic intrinsics require constants in the variadic arguments,
|
// Some variadic intrinsics require constants in the variadic arguments,
|
||||||
// which currently aren't markable as immarg.
|
// 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.
|
// 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
|
// gcroot is a special case, since it requires a constant argument which
|
||||||
// isn't also required to be a simple ConstantInt.
|
// isn't also required to be a simple ConstantInt.
|
||||||
if (CS.getIntrinsicID() == Intrinsic::gcroot)
|
if (CB.getIntrinsicID() == Intrinsic::gcroot)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Some intrinsic operands are required to be immediates.
|
// 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
|
// It is never allowed to replace the call argument to an intrinsic, but it
|
||||||
// may be possible for a call.
|
// may be possible for a call.
|
||||||
return !CS.isIntrinsic();
|
return !isa<IntrinsicInst>(CB);
|
||||||
}
|
}
|
||||||
case Instruction::ShuffleVector:
|
case Instruction::ShuffleVector:
|
||||||
// Shufflevector masks are constant.
|
// Shufflevector masks are constant.
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "llvm/Analysis/ScalarEvolution.h"
|
#include "llvm/Analysis/ScalarEvolution.h"
|
||||||
#include "llvm/IR/BasicBlock.h"
|
#include "llvm/IR/BasicBlock.h"
|
||||||
#include "llvm/IR/CFG.h"
|
#include "llvm/IR/CFG.h"
|
||||||
#include "llvm/IR/CallSite.h"
|
|
||||||
#include "llvm/IR/Constants.h"
|
#include "llvm/IR/Constants.h"
|
||||||
#include "llvm/IR/DebugInfoMetadata.h"
|
#include "llvm/IR/DebugInfoMetadata.h"
|
||||||
#include "llvm/IR/DebugLoc.h"
|
#include "llvm/IR/DebugLoc.h"
|
||||||
|
@ -428,8 +427,8 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
|
||||||
bool HasConvergent = false;
|
bool HasConvergent = false;
|
||||||
for (auto &BB : L->blocks())
|
for (auto &BB : L->blocks())
|
||||||
for (auto &I : *BB)
|
for (auto &I : *BB)
|
||||||
if (auto CS = CallSite(&I))
|
if (auto *CB = dyn_cast<CallBase>(&I))
|
||||||
HasConvergent |= CS.isConvergent();
|
HasConvergent |= CB->isConvergent();
|
||||||
assert((!HasConvergent || ULO.TripMultiple % ULO.Count == 0) &&
|
assert((!HasConvergent || ULO.TripMultiple % ULO.Count == 0) &&
|
||||||
"Unroll count must divide trip multiple if loop contains a "
|
"Unroll count must divide trip multiple if loop contains a "
|
||||||
"convergent operation.");
|
"convergent operation.");
|
||||||
|
|
Loading…
Reference in New Issue