[llvm] 3fd42f5 - [CoroCleanup] Invalidate analyses on changed functions before running SimplifyCFG

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 09:35:08 PDT 2023


Author: Arthur Eubanks
Date: 2023-03-14T09:34:55-07:00
New Revision: 3fd42f50d8aadb4d0c348ac17cd2115c1b0564a4

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

LOG: [CoroCleanup] Invalidate analyses on changed functions before running SimplifyCFG

Or else the sub-FunctionPassManager may see out of date analyses.

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroCleanup.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
index 81b43a2ab2c22..29978bef661c6 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
@@ -127,10 +127,16 @@ PreservedAnalyses CoroCleanupPass::run(Module &M,
   FunctionPassManager FPM;
   FPM.addPass(SimplifyCFGPass());
 
+  PreservedAnalyses FuncPA;
+  FuncPA.preserveSet<CFGAnalyses>();
+
   Lowerer L(M);
-  for (auto &F : M)
-    if (L.lower(F))
+  for (auto &F : M) {
+    if (L.lower(F)) {
+      FAM.invalidate(F, FuncPA);
       FPM.run(F, FAM);
+    }
+  }
 
   return PreservedAnalyses::none();
 }


        


More information about the llvm-commits mailing list