diff options
author | Matthias Braun <matze@braunis.de> | 2024-04-19 10:01:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-19 10:01:42 -0700 |
commit | 6bbccd2516c3a843809a8303da48abce58a88855 (patch) | |
tree | fb5c5666a20155ecc03c688671f02609a73225a7 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 41e696291c64fe19629e14887ed1ed9b9c2271f0 (diff) | |
download | llvm-6bbccd2516c3a843809a8303da48abce58a88855.zip llvm-6bbccd2516c3a843809a8303da48abce58a88855.tar.gz llvm-6bbccd2516c3a843809a8303da48abce58a88855.tar.bz2 |
GlobalsModRef, ValueTracking: Look through threadlocal.address intrinsic (#88418)
This improves handling of `threadlocal.address` intrinsic in analyses:
The thread-id cannot change within a function with the exception of
suspend points of pre-split coroutines. This changes
`llvm::getUnderlyingObject` to look through `threadlocal.address` in
these cases.
`GlobalsAAResult::AnalyzeUsesOfPointer` checks whether an address can be
traced to simple loads/stores or escapes to other places. Starting the
analysis from a thread-local `GlobalValue` the `threadlocal.address`
intrinsic is safe to skip here.
This improves issue #87437
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index b87bba7..c038f7e 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -6255,6 +6255,10 @@ bool llvm::isIntrinsicReturningPointerAliasingArgumentWithoutCapturing( return true; case Intrinsic::ptrmask: return !MustPreserveNullness; + case Intrinsic::threadlocal_address: + // The underlying variable changes with thread ID. The Thread ID may change + // at coroutine suspend points. + return !Call->getParent()->getParent()->isPresplitCoroutine(); default: return false; } |