[llvm] 31cdb29 - [DSE, MemorySSA] Return early when hitting a MemoryPhi.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 10:30:30 PDT 2020


Author: Florian Hahn
Date: 2020-08-29T18:28:26+01:00
New Revision: 31cdb29de46d08af3b721ce62377b6faa614cc32

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

LOG: [DSE,MemorySSA] Return early when hitting a MemoryPhi.

A MemoryPhi can never be eliminated. If we hit one, return the Phi, so
the caller can continue traversing the incoming accesses.

This saves some unnecessary read clobber checks and improves
compile-time
http://llvm-compile-time-tracker.com/compare.php?from=1ffc58b6d098ce8fa71f3a80fe75b990f633f921&to=d0fa8d1982380b57d7b6067528104bc373dbe07a&stat=instructions

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index ae4cc567f0a9..9825dfdf01cd 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -1847,8 +1847,10 @@ struct DSEState {
         return None;
       WalkerStepLimit -= StepCost;
 
+      // Return for MemoryPhis. They cannot be eliminated directly and the
+      // caller is responsible for traversing them.
       if (isa<MemoryPhi>(Current))
-        break;
+        return Current;
 
       // Below, check if CurrentDef is a valid candidate to be eliminated by
       // KillingDef. If it is not, check the next candidate.


        


More information about the llvm-commits mailing list