[PATCH] D63823: [InlineCost] make InlineCost assignable

Fedor Sergeev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 07:35:12 PDT 2019


fedor.sergeev created this revision.
fedor.sergeev added reviewers: eraman, greened, chandlerc, yrouban, apilipenko.
Herald added a subscriber: haicheng.
Herald added a project: LLVM.

Current InlineCost is not assignable because of const members Cost and Threshold.
I dont see practical benefits from having them const (access to these members is
private and internal interactions are rather simple). On other hand that makes
it hard to use as a member in some other data structure where assignability is necessary.

I'm going to use InlineCost in a downstream inliner that maintains a complex queue
of candidate call-sites and thus keeping and recalculating InlineCost is necessary.

This patch just removes 'const' from both members, making InlineCost assignable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63823

Files:
  llvm/include/llvm/Analysis/InlineCost.h


Index: llvm/include/llvm/Analysis/InlineCost.h
===================================================================
--- llvm/include/llvm/Analysis/InlineCost.h
+++ llvm/include/llvm/Analysis/InlineCost.h
@@ -67,10 +67,10 @@
   };
 
   /// The estimated cost of inlining this callsite.
-  const int Cost;
+  int Cost;
 
   /// The adjusted threshold against which this cost was computed.
-  const int Threshold;
+  int Threshold;
 
   /// Must be set for Always and Never instances.
   const char *Reason = nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63823.206665.patch
Type: text/x-patch
Size: 514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190626/a2dcce15/attachment.bin>


More information about the llvm-commits mailing list