From fbd601411e6f5cf34cba91acadc47ed84589d637 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 27 Jan 2017 22:55:30 +0000 Subject: [PATCH] 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 --- include/llvm/Analysis/TypeMetadataUtils.h | 5 +++-- lib/Analysis/TypeMetadataUtils.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/TypeMetadataUtils.h b/include/llvm/Analysis/TypeMetadataUtils.h index c3f688f5d7f..17906ba4e39 100644 --- a/include/llvm/Analysis/TypeMetadataUtils.h +++ b/include/llvm/Analysis/TypeMetadataUtils.h @@ -32,14 +32,15 @@ struct DevirtCallSite { /// call sites based on the call and return them in DevirtCalls. void findDevirtualizableCallsForTypeTest( SmallVectorImpl &DevirtCalls, - SmallVectorImpl &Assumes, CallInst *CI); + SmallVectorImpl &Assumes, const CallInst *CI); /// Given a call to the intrinsic @llvm.type.checked.load, find all /// devirtualizable call sites based on the call and return them in DevirtCalls. void findDevirtualizableCallsForTypeCheckedLoad( SmallVectorImpl &DevirtCalls, SmallVectorImpl &LoadedPtrs, - SmallVectorImpl &Preds, bool &HasNonCallUses, CallInst *CI); + SmallVectorImpl &Preds, bool &HasNonCallUses, + const CallInst *CI); } #endif diff --git a/lib/Analysis/TypeMetadataUtils.cpp b/lib/Analysis/TypeMetadataUtils.cpp index f5675416736..6871e4887c9 100644 --- a/lib/Analysis/TypeMetadataUtils.cpp +++ b/lib/Analysis/TypeMetadataUtils.cpp @@ -39,7 +39,7 @@ findCallsAtConstantOffset(SmallVectorImpl &DevirtCalls, // Search for virtual calls that load from VPtr and add them to DevirtCalls. static void -findLoadCallsAtConstantOffset(Module *M, +findLoadCallsAtConstantOffset(const Module *M, SmallVectorImpl &DevirtCalls, Value *VPtr, int64_t Offset) { for (const Use &U : VPtr->uses()) { @@ -62,10 +62,10 @@ findLoadCallsAtConstantOffset(Module *M, void llvm::findDevirtualizableCallsForTypeTest( SmallVectorImpl &DevirtCalls, - SmallVectorImpl &Assumes, CallInst *CI) { + SmallVectorImpl &Assumes, const CallInst *CI) { 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. for (const Use &CIU : CI->uses()) { @@ -86,7 +86,8 @@ void llvm::findDevirtualizableCallsForTypeTest( void llvm::findDevirtualizableCallsForTypeCheckedLoad( SmallVectorImpl &DevirtCalls, SmallVectorImpl &LoadedPtrs, - SmallVectorImpl &Preds, bool &HasNonCallUses, CallInst *CI) { + SmallVectorImpl &Preds, bool &HasNonCallUses, + const CallInst *CI) { assert(CI->getCalledFunction()->getIntrinsicID() == Intrinsic::type_checked_load); @@ -96,7 +97,7 @@ void llvm::findDevirtualizableCallsForTypeCheckedLoad( return; } - for (Use &U : CI->uses()) { + for (const Use &U : CI->uses()) { auto CIU = U.getUser(); if (auto EVI = dyn_cast(CIU)) { if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {