[llvm] r293341 - Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 14:55:30 PST 2017


Author: pcc
Date: Fri Jan 27 16:55:30 2017
New Revision: 293341

URL: http://llvm.org/viewvc/llvm-project?rev=293341&view=rev
Log:
Analysis: Add appropriate const qualification to functions in TypeMetadataUtils.cpp. NFC.

Modified:
    llvm/trunk/include/llvm/Analysis/TypeMetadataUtils.h
    llvm/trunk/lib/Analysis/TypeMetadataUtils.cpp

Modified: llvm/trunk/include/llvm/Analysis/TypeMetadataUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/TypeMetadataUtils.h?rev=293341&r1=293340&r2=293341&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/TypeMetadataUtils.h (original)
+++ llvm/trunk/include/llvm/Analysis/TypeMetadataUtils.h Fri Jan 27 16:55:30 2017
@@ -32,14 +32,15 @@ struct DevirtCallSite {
 /// call sites based on the call and return them in DevirtCalls.
 void findDevirtualizableCallsForTypeTest(
     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
 /// devirtualizable call sites based on the call and return them in DevirtCalls.
 void findDevirtualizableCallsForTypeCheckedLoad(
     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
     SmallVectorImpl<Instruction *> &LoadedPtrs,
-    SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI);
+    SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
+    const CallInst *CI);
 }
 
 #endif

Modified: llvm/trunk/lib/Analysis/TypeMetadataUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TypeMetadataUtils.cpp?rev=293341&r1=293340&r2=293341&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TypeMetadataUtils.cpp (original)
+++ llvm/trunk/lib/Analysis/TypeMetadataUtils.cpp Fri Jan 27 16:55:30 2017
@@ -39,7 +39,7 @@ findCallsAtConstantOffset(SmallVectorImp
 
 // Search for virtual calls that load from VPtr and add them to DevirtCalls.
 static void
-findLoadCallsAtConstantOffset(Module *M,
+findLoadCallsAtConstantOffset(const Module *M,
                               SmallVectorImpl<DevirtCallSite> &DevirtCalls,
                               Value *VPtr, int64_t Offset) {
   for (const Use &U : VPtr->uses()) {
@@ -62,10 +62,10 @@ findLoadCallsAtConstantOffset(Module *M,
 
 void llvm::findDevirtualizableCallsForTypeTest(
     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
-    SmallVectorImpl<CallInst *> &Assumes, CallInst *CI) {
+    SmallVectorImpl<CallInst *> &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::findDevirtualizableCallsForTy
 void llvm::findDevirtualizableCallsForTypeCheckedLoad(
     SmallVectorImpl<DevirtCallSite> &DevirtCalls,
     SmallVectorImpl<Instruction *> &LoadedPtrs,
-    SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses, CallInst *CI) {
+    SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
+    const CallInst *CI) {
   assert(CI->getCalledFunction()->getIntrinsicID() ==
          Intrinsic::type_checked_load);
 
@@ -96,7 +97,7 @@ void llvm::findDevirtualizableCallsForTy
     return;
   }
 
-  for (Use &U : CI->uses()) {
+  for (const Use &U : CI->uses()) {
     auto CIU = U.getUser();
     if (auto EVI = dyn_cast<ExtractValueInst>(CIU)) {
       if (EVI->getNumIndices() == 1 && EVI->getIndices()[0] == 0) {




More information about the llvm-commits mailing list