[llvm-dev] One more No-alias case on Alias analysis

JinGu Kang via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 11 10:37:06 PDT 2018


Oops, there is a typo on diff file. getLoBits(0) -->getLoBits(1)

On 11 Jun 2018, 18:06, at 18:06, "jingu at codeplay.com via llvm-dev" <llvm-dev at lists.llvm.org> wrote:
>Hello All,
>
>I have met one may-alias case from llvm's alias analysis. The code 
>snippet is as following:
>
>char buf[4];
>
>void test (int idx) {
>char *a = &buf[3 - idx];
>char *b = &buf[idx];
>*a = 1;
>*b = 2;
>}
>
>I can see below output from alias set tracker for above code snippet.
>
>Alias sets for function 'test':
>Alias Set Tracker: 1 alias sets for 2 pointer values.
>  AliasSet[0x53d8070, 2] may alias, Mod       Pointers: (i8* %arrayidx,
>
>1), (i8* %arrayidx2, 1)
>
>As you can see on above code snippet, the 'a' and 'b' are not aliased.
>I 
>think if we have following offset form, we can say No-alias between
>them.
>
>offset1 = odd_number - index
>
>offset2 = index
>
>I have implemented simple code for it and the output is as following:
>
>Alias sets for function 'test':
>Alias Set Tracker: 2 alias sets for 2 pointer values.
>  AliasSet[0x541a070, 1] must alias, Mod       Pointers: (i8*
>%arrayidx, 1)
>   AliasSet[0x541cc00, 1] must alias, Mod       Pointers: (i8* 
>%arrayidx2, 1)
>
>How do you think about this? Is it legal for current alias analysis or 
>not? I have attached the diff file as reference. If I missed something,
>
>please let me know.
>
>Thanks,
>
>JinGu Kang
>
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>LLVM Developers mailing list
>llvm-dev at lists.llvm.org
>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180611/39202bbf/attachment.html>


More information about the llvm-dev mailing list