[llvm] bb024c3 - [DSE,MemorySSA] Remove short-cut to check if all paths are covered.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 04:44:58 PDT 2020


Author: Florian Hahn
Date: 2020-08-27T12:42:40+01:00
New Revision: bb024c3c4e03458ae30721cb5e9cf9832dba56d7

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

LOG: [DSE,MemorySSA] Remove short-cut to check if all paths are covered.

The post-order number early continue does not work in some cases, e.g.
if a path from EarlierAccess to an exit includes a node that dominates
EarlierAccess in a cycle.

The short-cut only has very minor impact on compile-time, so it seems
straight-forward to remove it for now:

http://llvm-compile-time-tracker.com/compare.php?from=062412e79fcfedf2cf004433e42036b0333e3f83&to=d7386016a77ce1387bdbbf360f1de157faea9d31&stat=instructions

Fixes PR47285.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 3afe876c8ae6..0c7992031eb5 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -2019,11 +2019,6 @@ struct DSEState {
       if (PDT.dominates(CommonPred, EarlierAccess->getBlock())) {
         SetVector<BasicBlock *> WorkList;
 
-        // EarlierAccess's post-order number provides an upper bound of the
-        // blocks on a path starting at EarlierAccess.
-        unsigned UpperBound =
-            PostOrderNumbers.find(EarlierAccess->getBlock())->second;
-
         // If CommonPred is null, there are multiple exits from the function.
         // They all have to be added to the worklist.
         if (CommonPred)
@@ -2048,10 +2043,6 @@ struct DSEState {
           if (!DT.isReachableFromEntry(Current))
             continue;
 
-          unsigned CPO = PostOrderNumbers.find(Current)->second;
-          // Current block is not on a path starting at EarlierAccess.
-          if (CPO > UpperBound)
-            continue;
           for (BasicBlock *Pred : predecessors(Current))
             WorkList.insert(Pred);
 

diff  --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll
index 9736ce5ae315..aaff809d38d0 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll
@@ -25,6 +25,7 @@ define void @test(i1 %c.0, i1 %c.2, i1 %c.3, i1 %c.4, i1 %c.5, i1 %c.6) {
 ; CHECK-NEXT:    store i32 99, i32* @b, align 4
 ; CHECK-NEXT:    br i1 [[C_3:%.*]], label [[BB_5]], label [[BB_2]]
 ; CHECK:       bb.6:
+; CHECK-NEXT:    store i32 91, i32* @b, align 4
 ; CHECK-NEXT:    br i1 [[C_5:%.*]], label [[SPLIT_CRIT_EDGE_2:%.*]], label [[BB_2]]
 ; CHECK:       split_crit_edge.2:
 ; CHECK-NEXT:    store i32 27, i32* @b, align 4
@@ -32,6 +33,7 @@ define void @test(i1 %c.0, i1 %c.2, i1 %c.3, i1 %c.4, i1 %c.5, i1 %c.6) {
 ; CHECK:       bb.7:
 ; CHECK-NEXT:    br i1 [[C_4]], label [[INTERESTING:%.*]], label [[BB_8:%.*]]
 ; CHECK:       interesting:
+; CHECK-NEXT:    store i32 9, i32* @b, align 4
 ; CHECK-NEXT:    br i1 [[C_6:%.*]], label [[KILLER:%.*]], label [[BB_2]]
 ; CHECK:       killer:
 ; CHECK-NEXT:    store i32 23, i32* @b, align 4


        


More information about the llvm-commits mailing list