Skip to content

Commit fc9369a

Browse files
authored
[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.
1 parent e2cab7c commit fc9369a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clang/lib/Analysis/LifetimeSafety.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,11 @@ using ExpiredLoanMap = llvm::ImmutableMap<LoanID, const ExpireFact *>;
966966
/// An object to hold the factories for immutable collections, ensuring
967967
/// that all created states share the same underlying memory management.
968968
struct LifetimeFactory {
969-
OriginLoanMap::Factory OriginMapFactory;
970-
LoanSet::Factory LoanSetFactory;
971-
ExpiredLoanMap::Factory ExpiredLoanMapFactory;
969+
llvm::BumpPtrAllocator Allocator;
970+
OriginLoanMap::Factory OriginMapFactory{Allocator, /*canonicalize=*/false};
971+
LoanSet::Factory LoanSetFactory{Allocator, /*canonicalize=*/false};
972+
ExpiredLoanMap::Factory ExpiredLoanMapFactory{Allocator,
973+
/*canonicalize=*/false};
972974
};
973975

974976
/// Represents the dataflow lattice for loan propagation.

0 commit comments

Comments
 (0)