[llvm-dev] alias.scope and local restricted C pointers

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 16 20:31:52 PDT 2018


On 08/16/2018 07:52 PM, Bekket McClane via llvm-dev wrote:
>
>
>> On Aug 16, 2018, at 4:41 PM, Troy Johnson via llvm-dev
>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>> Concerning slide 16
>> of https://llvm.org/devmtg/2017-02-04/Restrict-Qualified-Pointers-in-LLVM.pdf
>>  
>> Specifically “Currently, LLVM only supports restrict on function
>> arguments, although we have a way to preserve that information if the
>> function is inlined.”
>>  
>> Is that statement still accurate? 
>
> Yes, correct (actually I was just working on restrict, no_alias and
> alias.scope attributes). The inliner also propagates them correctly. 
>
>> It would seem
>> that https://llvm.org/docs/LangRef.html#noalias-and-alias-scope-metadata should
>> be sufficiently general to honor C’s restrict qualifier on local
>> pointers,
>> but it does not appear that Clang uses this part of LLVM’s IR for
>> that purpose today and thus local restricts are ignored.
>
> I think that’s correct, but I haven’t come out with any scenarios
> regarding local variables/memory that can _not_ be solved by AA. As
> BasicAA is able to solved most of the local cases, including malloc
> and some memory intrinsics.

int *restrict x = some_external_function();
int *restrict y = some_other_external_function();

This is one of the fundamental use cases for restrict and BasicAA has
nothing to offer in this regard. In other words, it's a mechanism for
encoding an interface contract.

 -Hal

>
> Best
> Bekket
>>  
>> Thanks,
>> Troy
>>  
>>  
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180816/8d9d49db/attachment-0001.html>


More information about the llvm-dev mailing list