Author: Utkarsh Saxena
Date: 2025-09-25T16:11:55Z
New Revision: fc9369a70ecc9c260f3eb1af9cbc3ded24e9d4fb

URL: 
https://github.com/llvm/llvm-project/commit/fc9369a70ecc9c260f3eb1af9cbc3ded24e9d4fb
DIFF: 
https://github.com/llvm/llvm-project/commit/fc9369a70ecc9c260f3eb1af9cbc3ded24e9d4fb.diff

LOG: [LifetimeSafety] Disable canonicalization in immutable collections 
(#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.

Added: 
    

Modified: 
    clang/lib/Analysis/LifetimeSafety.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/LifetimeSafety.cpp 
b/clang/lib/Analysis/LifetimeSafety.cpp
index 0dd5716d93fb6..c22268a590791 100644
--- a/clang/lib/Analysis/LifetimeSafety.cpp
+++ b/clang/lib/Analysis/LifetimeSafety.cpp
@@ -966,9 +966,11 @@ 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;
+  llvm::BumpPtrAllocator Allocator;
+  OriginLoanMap::Factory OriginMapFactory{Allocator, /*canonicalize=*/false};
+  LoanSet::Factory LoanSetFactory{Allocator, /*canonicalize=*/false};
+  ExpiredLoanMap::Factory ExpiredLoanMapFactory{Allocator,
+                                                /*canonicalize=*/false};
 };
 
 /// Represents the dataflow lattice for loan propagation.


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to