[llvm] r245921 - Pass function attributes instead of boolean in isIntDivCheap().

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 23:16:56 PDT 2015


> On Aug 24, 2015, at 10:37 PM, Eric Christopher <echristo at gmail.com> wrote:
> 
> 
> 
> On Mon, Aug 24, 2015 at 10:06 PM Steve King <steve at metrokings.com <mailto:steve at metrokings.com>> wrote:
> On Mon, Aug 24, 2015 at 7:53 PM, Eric Christopher <echristo at gmail.com <mailto:echristo at gmail.com>> wrote:
> > Bike shed: how about pass the function around instead.
> 
> Mehdi Amini advised to pass attributes instead of the function.
> 
>  Huh. I wonder why? My logic: ISel lowering in general is subtarget based so we're already doing a lot of function based things around this. Also it means that you have to explicitly ask for the attribute set (which you obviously didn't have in either place) rather than the single place. I'm not wedded to it, but curious :)
> 

Just general API design I guess, I’m less familiar with similar methods in the backend as you are, but if I see a method taking a Function I will wonder why it need to poke at the function. 
The intent seem more clear to me if the argument can be more specific. For instance, I wouldn’t pass a Module as parameter to a function that needs to access the DataLayout.

— 
Mehdi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150824/eee555cb/attachment.html>


More information about the llvm-commits mailing list