+31
−0
Loading
isAllocSiteRemovable() walks all transitive users of an alloc site, but sites with many users are almost never removable. Profiling on real-world codegen workloads (73,943 alloc sites) showed: - 89 removable sites, max 1,392 users walked - 73,854 non-removable sites, avg 31,305 users walked - 2.31B total wasted user visits (~400s wall-clock on a 35-min build) Skip the removability analysis when direct user count exceeds a configurable threshold (default 2048, tunable via hidden cl::opt -instcombine-max-allocsite-removable-users). Also defer WeakTrackingVH conversion: collect into Instruction* first and convert only when the site is actually removable.