Skip to content
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

Pointer TBAA Improvements #9811

Open
wants to merge 15 commits into
base: stable/20240723
Choose a base branch
from

Conversation

fhahn
Copy link

@fhahn fhahn commented Jan 8, 2025

No description provided.

@fhahn fhahn requested a review from a team as a code owner January 8, 2025 15:13
@fhahn
Copy link
Author

fhahn commented Jan 8, 2025

@swift-ci please test

@fhahn
Copy link
Author

fhahn commented Jan 8, 2025

@swift-ci please test llvm

@fhahn
Copy link
Author

fhahn commented Jan 9, 2025

@swift-ci please test

fhahn added 15 commits January 9, 2025 19:19
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)
…#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)
Further extends the test coverage added in 1aff96b with a load with
noundef and invariant.load metadata, which may trigger UB.

(cherry picked from commit 7ac62f3)
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)
@fhahn fhahn force-pushed the pick-pointer-tbaa branch from b76a948 to 0f3de86 Compare January 9, 2025 22:28
@fhahn
Copy link
Author

fhahn commented Jan 10, 2025

@swift-ci please smoke test

@fhahn
Copy link
Author

fhahn commented Jan 10, 2025

@swift-ci please smoke test macOS

@fhahn
Copy link
Author

fhahn commented Jan 10, 2025

@swift-ci Please smoke test macOS platform


@fhahn
Copy link
Author

fhahn commented Jan 10, 2025

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant