Skip to content

Commit 29fada4

Browse files
committed
[EarlyCSE] Don't eagerly optimize MemoryUses
EarlyCSE currently optimizes all MemoryUses upfront. However, EarlyCSE only actually queries the clobbering memory access for a subset of uses, namely those where a CSE candidate has already been identified. Delaying use optimization to the clobber query improves compile-time in practice. This change is not NFC because EarlyCSE has a limit on the number of clobber queries (EarlyCSEMssaOptCap), in which case it falls back to the defining access. The defining access for uses will now no longer coincide with the optimized access. If there are performance regressions from this change, we should be able to address them by raising this limit. Differential Revision: https://reviews.llvm.org/D121987
1 parent a6d2385 commit 29fada4

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,7 @@ class EarlyCSE {
598598
const TargetTransformInfo &TTI, DominatorTree &DT,
599599
AssumptionCache &AC, MemorySSA *MSSA)
600600
: TLI(TLI), TTI(TTI), DT(DT), AC(AC), SQ(DL, &TLI, &DT, &AC), MSSA(MSSA),
601-
MSSAUpdater(std::make_unique<MemorySSAUpdater>(MSSA)) {
602-
if (MSSA)
603-
MSSA->ensureOptimizedUses();
604-
}
601+
MSSAUpdater(std::make_unique<MemorySSAUpdater>(MSSA)) {}
605602

606603
bool run();
607604

0 commit comments

Comments
 (0)