[llvm-commits] EmitLibCalls: check TargetLibraryInfo

Eli Friedman eli.friedman at gmail.com
Tue Jul 24 19:46:53 PDT 2012


On Tue, Jul 24, 2012 at 7:27 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>> On Tue, Jul 24, 2012 at 2:14 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
>>>
>>> Hi,
>>>
>>> Please find in attach a patch that makes EmitLibCalls consult the
>>> TargetLibraryInfo data before creating a call to a library function. It
>>> makes these Emit*() functions return 0 if the function is not available.
>>>
>>> Any comments?
>>
>>
>> The convention of returning null is dangerous, as demonstrated by the
>> fact that you messed it up in multiple places.  Maybe use
>> llvm::Optional?
>>
>> Otherwise, looks fine.
>
>
> Thanks for the review!
> Actually returning null is really convenient in a number of places, since
> instcombine and simplifylibcalls interpret the return of null as "didn't
> change anything".

Hmm... I guess it's okay, then.

> I've hopefully audited all call sites.

Did you mean to attach a new version?

-Eli



More information about the llvm-commits mailing list