[llvm-dev] TBAA question
Venkataramanan Kumar via llvm-dev
llvm-dev at lists.llvm.org
Fri Nov 15 08:49:06 PST 2019
Hi Neil
On Fri, 15 Nov 2019 at 15:26, Neil Henning <neil.henning at unity3d.com> wrote:
> What are you querying the alias analysis on in the above example - between
> the load and store?
>
I am interested to check if the load "%2" is not changed inside the
function (assuming there are no function calls). I am checking to see if
there are any store instructions in that function that could aliases and
modify the load.
> How are you creating your MemoryLocation for those too?
>
I query using alias method as shown below.
MemoryLocation Locld = MemoryLocation::get(Loadinst);
MemoryLocation Locst = MemoryLocation::get(Storeinst);
if (AA->alias(Loc,Locst) != llvm::NoAlias ) {
==> it reaches here
}
Also checked modref info.
if(isModSet(AA->getModRefInfo(Storeinst, Loc))
{
==> it reaches here
}
regards,
Venkat,
>
> On Fri, Nov 15, 2019 at 6:03 AM Venkataramanan Kumar via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Can someone please clarify me on this?
>>
>>
>>
>> On Wed, 13 Nov 2019 at 22:25, Venkataramanan Kumar <
>> venkataramanan.kumar.llvm at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have the following LLVM IR.
>>>
>>> ----Snip---
>>> %1 = getelementptr inbounds %struct._X, %struct._X* %0, i64 0, i32 3
>>> %2 = load %struct._X*, %struct._X** %1, align 8, !tbaa !10
>>> ....
>>> .....
>>> .......
>>>
>>> %3 = bitcast %struct._Y** %1 to i8**
>>> store i8* null, i8** %3, align 8, !tbaa !9
>>>
>>> !9 = !{!7, !7, i64 0}
>>> !7 = !{!"omnipotent char", !8, i64 0}
>>> !8 = !{!"Simple C/C++ TBAA"}
>>>
>>> ----Snip----
>>>
>>> Load inst above is trying to access a field of _X which is a self
>>> recursive pointer to same struct _X.
>>> Store puts a null value for a pointer to struct _Y. It has been
>>> bitcasted to i8** and store happens via char pointer.
>>>
>>>
>>> When I query alias analysis although loads and stores are pointers to
>>> different struct types. TBAA says may alias.
>>> is it safe to assume the loaded pointer to struct _X do not alias with
>>> the store , if we look further at bitcast and see the pointer to different
>>> struct?
>>>
>>> is my understanding wrong here?
>>>
>>> regards,
>>> Venkat,
>>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
>
> --
> Neil Henning
> Senior Software Engineer Compiler
> unity.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191115/d6bdfdd1/attachment-0001.html>
More information about the llvm-dev
mailing list