[llvm] 29fada4 - [EarlyCSE] Don't eagerly optimize MemoryUses

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 08:47:43 PDT 2022


Author: Nikita Popov
Date: 2022-03-23T16:47:35+01:00
New Revision: 29fada4a3d3db309f11f7fa7a0c61cd4021e9947

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

LOG: [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

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/EarlyCSE.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
index ac0cc9560c69d..331e9b429d4ba 100644
--- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -598,10 +598,7 @@ class EarlyCSE {
            const TargetTransformInfo &TTI, DominatorTree &DT,
            AssumptionCache &AC, MemorySSA *MSSA)
       : TLI(TLI), TTI(TTI), DT(DT), AC(AC), SQ(DL, &TLI, &DT, &AC), MSSA(MSSA),
-        MSSAUpdater(std::make_unique<MemorySSAUpdater>(MSSA)) {
-    if (MSSA)
-      MSSA->ensureOptimizedUses();
-  }
+        MSSAUpdater(std::make_unique<MemorySSAUpdater>(MSSA)) {}
 
   bool run();
 


        


More information about the llvm-commits mailing list