[llvm-dev] InlineCost.cpp -- Use addCost instead of Cost += ...?

chuanqi.xcq via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 9 19:33:05 PST 2021


Hi Riyaz,

   Personally, I think this is a good fix. I think you could try to contribute this. Here is the contribute doc: https://llvm.org/docs/Contributing.html

Thanks,
Chuanqi
------------------------------------------------------------------
From:llvm-dev <llvm-dev at lists.llvm.org>
Send Time:2021年12月10日(星期五) 10:30
To:llvm-dev <llvm-dev at lists.llvm.org>
Subject:[llvm-dev] InlineCost.cpp -- Use addCost instead of Cost += ...?

  
Shouldn’t this:
https://llvm.org/doxygen/InlineCost_8cpp_source.html
  977     // If this function uses the coldcc calling convention, prefer not to inline
  978     // it.
  979     if (F.getCallingConv() ==  CallingConv::Cold)
  980       Cost +=  InlineConstants::ColdccPenalty;
 
be changed to:
 
  977     // If this function uses the coldcc calling convention, prefer not to inline
  978     // it.
  979     if (F.getCallingConv() ==  CallingConv::Cold)
  980       addCost(InlineConstants::ColdccPenalty);
Maybe, it is unlikely for Cost to overflow that early in the cost computation but for consistency’s sake, it should perhaps use addCost.
/Riyaz  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211210/755609fa/attachment.html>


More information about the llvm-dev mailing list