[llvm] r364612 - [InlineCost] make InlineCost assignable

Fedor Sergeev via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 16:41:03 PDT 2019


Author: fedor.sergeev
Date: Thu Jun 27 16:41:03 2019
New Revision: 364612

URL: http://llvm.org/viewvc/llvm-project?rev=364612&view=rev
Log:
[InlineCost] make InlineCost assignable

Summary:
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.

Reviewers: eraman, greened, chandlerc, yrouban, apilipenko
Reviewed By: apilipenko
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63823

Modified:
    llvm/trunk/include/llvm/Analysis/InlineCost.h

Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/InlineCost.h?rev=364612&r1=364611&r2=364612&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/InlineCost.h (original)
+++ llvm/trunk/include/llvm/Analysis/InlineCost.h Thu Jun 27 16:41:03 2019
@@ -67,10 +67,10 @@ class InlineCost {
   };
 
   /// 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;




More information about the llvm-commits mailing list