-
Notifications
You must be signed in to change notification settings - Fork 344
Pointer TBAA Improvements #9811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci please test |
@swift-ci please test llvm |
@swift-ci please test |
Precommit tests for follow-up improvements to Clang's TBAA emission. Also add variants with -pointer-tbaa to tbaa-reference.cpp. (cherry picked from commit df3f291)
…0569) Extend the logic added in 123c036 (llvm#76612) to support pointers to non-builtin types by using the mangled name of the canonical type. PR: llvm#110569 (cherry picked from commit 4334f31)
Currently we generate incorrect metadata not considering compatible types in C. (cherry picked from commit c4eeef3)
Be conservative if the type isn't a record type. Handling other types may require stripping const-qualifiers inside the type, e.g. MemberPointerType. Also look through array types same as through pointer types, to not pessimize arrays of pointers. Without this, we assign different tags to the accesses for p an q in the second test in cwg158. PR: llvm#116991 (cherry picked from commit decb874)
…16596) For unnamed structs or unions, C's compatible types rule applies. Two compatible types in different compilation units can have different mangled names, meaning the metadata emitted below would incorrectly mark them as no-alias. Use AnyPtr for such types in both C and C++, as C and C++ types may be visible when doing LTO. PR: llvm#116596 (cherry picked from commit 41a0c66)
(cherry picked from commit a41ae90)
…#116382) When sinking a store, preserve common metadata present on stores on both sides of the diamond. PR: llvm#116382 (cherry picked from commit 3734e4c)
Test cases for llvm#115595. (cherry picked from commit 1aff96b)
Add variant with different metadata on all loads, for llvm#115868 (cherry picked from commit 9e0ea8c)
…vm#115868) Preserve llvm.access.group metadata on the replacement instruction, if it does not move. In that case, the program would be UB, if the parallel property encoded in the metadata does not hold. This matches the LangRef recently updated in llvm#116220 PR llvm#115868 (cherry picked from commit 0765136)
Preserve tbaa metadata on the replacement instruction, if it does not move. In that case, the program would be UB, if the aliasing property encoded in the metadata does not hold. This makes use of the clarification re tbaa metadata implying UB if the property does not hold: llvm#116220 Same as llvm#115868, but for !tbaa PR: llvm#116682 (cherry picked from commit 0bb1b68)
…ves (llvm#117716) Preserve !alias.scope, !noalias and !mem.parallel_loop_access metadata on the replacement instruction, if it does not move. In that case, the program would be UB, if the aliasing property encoded in the metadata does not hold. This makes use of the clarification re aliasing metadata implying UB if the property does not hold: llvm#116220 Same as llvm#115868, but for !alias.scope, !noalias and !mem.parallel_loop_access. PR: llvm#117716 (cherry picked from commit 46a0857)
b76a948
to
0f3de86
Compare
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
@swift-ci Please smoke test macOS platform |
@swift-ci please test |
// COMMON-LABEL: define void @unamed_struct_typedef( | ||
// COMMON-SAME: ptr noundef %ptr) | ||
// COMMON-NEXT: entry: | ||
// COMMON-NEXT: [[PTR_ADDR:%.+]] = alloca ptr, align 8 | ||
// DEFAULT-NEXT: store ptr %ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] | ||
// DEFAULT-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[ANYPTR]] | ||
// ENABLED-NEXT: store ptr %ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[P1TYPEDEF:!.+]] | ||
// ENABLED-NEXT: [[L0:%.+]] = load ptr, ptr [[PTR_ADDR]], align 8, !tbaa [[P1TYPEDEF]] | ||
// COMMON-NEXT: [[GEP:%.+]] = getelementptr inbounds %struct.TypedefS, ptr [[L0]], i32 0, i32 0 | ||
// COMMON-NEXT: store i32 0, ptr [[GEP]], align 4 | ||
// COMMON-NEXT: ret void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This piece doesn't use a placeholder for %ptr
like the rest of the pieces do (changed in 123c036). It seems that sometimes this can be %0
, but I am not sure about why.
No description provided.