-
Notifications
You must be signed in to change notification settings - Fork 15k
[LifetimeSafety] Disable canonicalization in immutable collections #159850
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
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
05da67b to
9916bec
Compare
|
@llvm/pr-subscribers-clang-temporal-safety @llvm/pr-subscribers-clang-analysis Author: Utkarsh Saxena (usx95) ChangesDisable canonicalization in immutable collections for lifetime analysis. Modified the Full diff: https://github.com/llvm/llvm-project/pull/159850.diff 1 Files Affected:
diff --git a/clang/lib/Analysis/LifetimeSafety.cpp b/clang/lib/Analysis/LifetimeSafety.cpp
index 0dd5716d93fb6..43cab406a9dc3 100644
--- a/clang/lib/Analysis/LifetimeSafety.cpp
+++ b/clang/lib/Analysis/LifetimeSafety.cpp
@@ -966,9 +966,12 @@ using ExpiredLoanMap = llvm::ImmutableMap<LoanID, const ExpireFact *>;
/// An object to hold the factories for immutable collections, ensuring
/// that all created states share the same underlying memory management.
struct LifetimeFactory {
- OriginLoanMap::Factory OriginMapFactory;
- LoanSet::Factory LoanSetFactory;
- ExpiredLoanMap::Factory ExpiredLoanMapFactory;
+ // Avoid canonicalising
+ OriginLoanMap::Factory OriginMapFactory =
+ OriginLoanMap::Factory(/*canonicalize=*/false);
+ LoanSet::Factory LoanSetFactory = LoanSet::Factory(/*canonicalize=*/false);
+ ExpiredLoanMap::Factory ExpiredLoanMapFactory =
+ ExpiredLoanMap::Factory(/*canonicalize=*/false);
};
/// Represents the dataflow lattice for loan propagation.
|
9916bec to
0775d9e
Compare
0775d9e to
53adfd8
Compare
…lvm#159850) Disable canonicalization in immutable collections for lifetime analysis. Modified the `LifetimeFactory` struct in `LifetimeSafety.cpp` to explicitly initialize the immutable collection factories with `canonicalize=false`. This prevents the factories from canonicalizing their data structures, which can improve performance by avoiding unnecessary comparisons and digest computations.

Disable canonicalization in immutable collections for lifetime analysis.
Modified the
LifetimeFactorystruct inLifetimeSafety.cppto explicitly initialize the immutable collection factories withcanonicalize=false. This prevents the factories from canonicalizing their data structures, which can improve performance by avoiding unnecessary comparisons and digest computations.