Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit fbd6014

Browse files
committed
Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293341 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 001f567 commit fbd6014

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

include/llvm/Analysis/TypeMetadataUtils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ struct DevirtCallSite {
3232
/// call sites based on the call and return them in DevirtCalls.
3333
void findDevirtualizableCallsForTypeTest(
3434
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
35-
SmallVectorImpl<CallInst *> &Assumes, CallInst *CI);
35+
SmallVectorImpl<CallInst *> &Assumes, const CallInst *CI);
3636

3737
/// Given a call to the intrinsic @llvm.type.checked.load, find all
3838
/// devirtualizable call sites based on the call and return them in DevirtCalls.
3939
void findDevirtualizableCallsForTypeCheckedLoad(
4040
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
4141
SmallVectorImpl<Instruction *> &LoadedPtrs,
42-
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI);
42+
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
43+
const CallInst *CI);
4344
}
4445

4546
#endif

lib/Analysis/TypeMetadataUtils.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ findCallsAtConstantOffset(SmallVectorImpl<DevirtCallSite> &DevirtCalls,
3939

4040
// Search for virtual calls that load from VPtr and add them to DevirtCalls.
4141
static void
42-
findLoadCallsAtConstantOffset(Module *M,
42+
findLoadCallsAtConstantOffset(const Module *M,
4343
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
4444
Value *VPtr, int64_t Offset) {
4545
for (const Use &U : VPtr->uses()) {
@@ -62,10 +62,10 @@ findLoadCallsAtConstantOffset(Module *M,
6262

6363
void llvm::findDevirtualizableCallsForTypeTest(
6464
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
65-
SmallVectorImpl<CallInst *> &Assumes, CallInst *CI) {
65+
SmallVectorImpl<CallInst *> &Assumes, const CallInst *CI) {
6666
assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_test);
6767

68-
Module *M = CI->getParent()->getParent()->getParent();
68+
const Module *M = CI->getParent()->getParent()->getParent();
6969

7070
// Find llvm.assume intrinsics for this llvm.type.test call.
7171
for (const Use &CIU : CI->uses()) {
@@ -86,7 +86,8 @@ void llvm::findDevirtualizableCallsForTypeTest(
8686
void llvm::findDevirtualizableCallsForTypeCheckedLoad(
8787
SmallVectorImpl<DevirtCallSite> &DevirtCalls,
8888
SmallVectorImpl<Instruction *> &LoadedPtrs,
89-
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI) {
89+
SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
90+
const CallInst *CI) {
9091
assert(CI->getCalledFunction()->getIntrinsicID() ==
9192
Intrinsic::type_checked_load);
9293

@@ -96,7 +97,7 @@ void llvm::findDevirtualizableCallsForTypeCheckedLoad(
9697
return;
9798
}
9899

99-
for (Use &U : CI->uses()) {
100+
for (const Use &U : CI->uses()) {
100101
auto CIU = U.getUser();
101102
if (auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
102103
if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {

0 commit comments

Comments
 (0)