[llvm] 0cdd671 - [CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 09:55:37 PDT 2022


Author: Arthur Eubanks
Date: 2022-09-29T09:55:23-07:00
New Revision: 0cdd671df919974bed11293e37ac917cac55be64

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

LOG: [CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs

f77342693 handled the adaptor and pass manager but missed the devirt wrapper.

Added: 
    

Modified: 
    llvm/lib/Analysis/CGSCCPassManager.cpp
    llvm/test/Other/invalidated-cgscc-invalidate-analyses.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index 0e96057b69a8b..1edda392e9b27 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -413,12 +413,12 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
     else
       PI.runAfterPass<LazyCallGraph::SCC>(*Pass, *C, PassPA);
 
+    PA.intersect(PassPA);
+
     // If the SCC structure has changed, bail immediately and let the outer
     // CGSCC layer handle any iteration to reflect the refined structure.
-    if (UR.UpdatedC && UR.UpdatedC != C) {
-      PA.intersect(std::move(PassPA));
+    if (UR.UpdatedC && UR.UpdatedC != C)
       break;
-    }
 
     // If the CGSCC pass wasn't able to provide a valid updated SCC, the
     // current SCC may simply need to be skipped if invalid.
@@ -470,7 +470,6 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
       }
 
     if (!Devirt) {
-      PA.intersect(std::move(PassPA));
       break;
     }
 
@@ -482,7 +481,6 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
           dbgs() << "Found another devirtualization after hitting the max "
                     "number of repetitions ("
                  << MaxIterations << ") on SCC: " << *C << "\n");
-      PA.intersect(std::move(PassPA));
       break;
     }
 
@@ -496,8 +494,6 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
     // Update the analysis manager with each run and intersect the total set
     // of preserved analyses so we're ready to iterate.
     AM.invalidate(*C, PassPA);
-
-    PA.intersect(std::move(PassPA));
   }
 
   // Note that we don't add any preserved entries here unlike a more normal

diff  --git a/llvm/test/Other/invalidated-cgscc-invalidate-analyses.ll b/llvm/test/Other/invalidated-cgscc-invalidate-analyses.ll
index 5dac08a704c8f..d9911bb559f7b 100644
--- a/llvm/test/Other/invalidated-cgscc-invalidate-analyses.ll
+++ b/llvm/test/Other/invalidated-cgscc-invalidate-analyses.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -passes='require<no-op-module>,inline' < %s -S -debug-pass-manager 2>&1 | FileCheck %s
+; RUN: opt -passes='require<no-op-module>,cgscc(devirt<1>(inline))' < %s -S -debug-pass-manager 2>&1 | FileCheck %s
 
 ; CHECK: Invalidating analysis: NoOpModuleAnalysis
 


        


More information about the llvm-commits mailing list