[flang-commits] [flang] [flang] Restructured TBAA trees in AddAliasTags pass. (PR #136725)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Wed Apr 23 19:06:47 PDT 2025
vzakhari wrote:
> Makes sense to me. Does it work ok with LLVM inlining?
Almost missed the question :)
Yes, it should work same way with LLVM inlining as before, but that does not mean our current TBAA approach is valid right now.
Our TBAA is invalid for the following case:
```
subroutine callee(x,y)
real :: x, y
x = 1.0
y = 2.0
end subroutine callee
subroutine test(x,y)
real, target :: x(2), y(3)
call callee(x(1), y(1))
call callee(x(2), y(2))
end subroutine test
```
Consider the case where `LOC(x(1)) == LOC(y(2))`. After LLVM inlining we will have:
```
define void @test_(ptr writeonly captures(none) %0, ptr writeonly captures(none) %1) local_unnamed_addr !dbg !4 {
store float 1.000000e+00, ptr %0, align 4, !dbg !14, !tbaa !19
store float 2.000000e+00, ptr %1, align 4, !dbg !25, !tbaa !26
%3 = getelementptr i8, ptr %0, i64 4, !dbg !28
%4 = getelementptr i8, ptr %1, i64 4, !dbg !28
store float 1.000000e+00, ptr %3, align 4, !dbg !29, !tbaa !19
store float 2.000000e+00, ptr %4, align 4, !dbg !31, !tbaa !26
ret void, !dbg !32
}
```
So it says that the first and last stores do not alias, which is not true.
https://github.com/llvm/llvm-project/pull/136725
More information about the flang-commits
mailing list