[llvm-dev] TBAA question

Venkataramanan Kumar via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 13 08:55:57 PST 2019


I have the following LLVM IR.

%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"}


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

is my understanding wrong here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191113/510cb075/attachment.html>

More information about the llvm-dev mailing list