diff --git a/llvm/lib/Transforms/Utils/GlobalStatus.cpp b/llvm/lib/Transforms/Utils/GlobalStatus.cpp --- 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 @@ 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(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 --- 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 @@ return true; case Instruction::Call: case Instruction::Invoke: { - ImmutableCallSite CS(I); + const auto &CB = cast(*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(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(CB); } case Instruction::ShuffleVector: // Shufflevector masks are constant. diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp --- 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 @@ 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(&I)) + HasConvergent |= CB->isConvergent(); assert((!HasConvergent || ULO.TripMultiple % ULO.Count == 0) && "Unroll count must divide trip multiple if loop contains a " "convergent operation.");