Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC.
llvm-svn: 293341
This commit is contained in:
parent
d1508812f5
commit
5ad775f2e8
|
@ -32,14 +32,15 @@ struct DevirtCallSite {
|
||||||
/// call sites based on the call and return them in DevirtCalls.
|
/// call sites based on the call and return them in DevirtCalls.
|
||||||
void findDevirtualizableCallsForTypeTest(
|
void findDevirtualizableCallsForTypeTest(
|
||||||
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
SmallVectorImpl<CallInst *> &Assumes, CallInst *CI);
|
SmallVectorImpl<CallInst *> &Assumes, const CallInst *CI);
|
||||||
|
|
||||||
/// Given a call to the intrinsic @llvm.type.checked.load, find all
|
/// Given a call to the intrinsic @llvm.type.checked.load, find all
|
||||||
/// devirtualizable call sites based on the call and return them in DevirtCalls.
|
/// devirtualizable call sites based on the call and return them in DevirtCalls.
|
||||||
void findDevirtualizableCallsForTypeCheckedLoad(
|
void findDevirtualizableCallsForTypeCheckedLoad(
|
||||||
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
SmallVectorImpl<Instruction *> &LoadedPtrs,
|
SmallVectorImpl<Instruction *> &LoadedPtrs,
|
||||||
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI);
|
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
|
||||||
|
const CallInst *CI);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,7 +39,7 @@ findCallsAtConstantOffset(SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
|
|
||||||
// Search for virtual calls that load from VPtr and add them to DevirtCalls.
|
// Search for virtual calls that load from VPtr and add them to DevirtCalls.
|
||||||
static void
|
static void
|
||||||
findLoadCallsAtConstantOffset(Module *M,
|
findLoadCallsAtConstantOffset(const Module *M,
|
||||||
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
Value *VPtr, int64_t Offset) {
|
Value *VPtr, int64_t Offset) {
|
||||||
for (const Use &U : VPtr->uses()) {
|
for (const Use &U : VPtr->uses()) {
|
||||||
|
@ -62,10 +62,10 @@ findLoadCallsAtConstantOffset(Module *M,
|
||||||
|
|
||||||
void llvm::findDevirtualizableCallsForTypeTest(
|
void llvm::findDevirtualizableCallsForTypeTest(
|
||||||
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
SmallVectorImpl<CallInst *> &Assumes, CallInst *CI) {
|
SmallVectorImpl<CallInst *> &Assumes, const CallInst *CI) {
|
||||||
assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_test);
|
assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_test);
|
||||||
|
|
||||||
Module *M = CI->getParent()->getParent()->getParent();
|
const Module *M = CI->getParent()->getParent()->getParent();
|
||||||
|
|
||||||
// Find llvm.assume intrinsics for this llvm.type.test call.
|
// Find llvm.assume intrinsics for this llvm.type.test call.
|
||||||
for (const Use &CIU : CI->uses()) {
|
for (const Use &CIU : CI->uses()) {
|
||||||
|
@ -86,7 +86,8 @@ void llvm::findDevirtualizableCallsForTypeTest(
|
||||||
void llvm::findDevirtualizableCallsForTypeCheckedLoad(
|
void llvm::findDevirtualizableCallsForTypeCheckedLoad(
|
||||||
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
|
||||||
SmallVectorImpl<Instruction *> &LoadedPtrs,
|
SmallVectorImpl<Instruction *> &LoadedPtrs,
|
||||||
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI) {
|
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
|
||||||
|
const CallInst *CI) {
|
||||||
assert(CI->getCalledFunction()->getIntrinsicID() ==
|
assert(CI->getCalledFunction()->getIntrinsicID() ==
|
||||||
Intrinsic::type_checked_load);
|
Intrinsic::type_checked_load);
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ void llvm::findDevirtualizableCallsForTypeCheckedLoad(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Use &U : CI->uses()) {
|
for (const Use &U : CI->uses()) {
|
||||||
auto CIU = U.getUser();
|
auto CIU = U.getUser();
|
||||||
if (auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
|
if (auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
|
||||||
if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {
|
if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {
|
||||||
|
|
Loading…
Reference in New Issue