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

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 23:17:52 PDT 2015


On Mon, Aug 24, 2015 at 11:16 PM Mehdi Amini <mehdi.amini at apple.com> wrote:

>
> 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> wrote:
>
>> On Mon, Aug 24, 2015 at 7:53 PM, Eric Christopher <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.
>

Sure, I can agree with that. I was thinking more the "hey, I'd like to
inspect more about the function", but as I said, don't care that much, just
curious about the logic here.

-eric


>
>> Mehdi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150825/0ff19ec8/attachment.html>


More information about the llvm-commits mailing list