[llvm] e962fa7 - [OpenMPOpt][FIX] Internalization is an IR change too

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 18:06:44 PDT 2023


Author: Johannes Doerfert
Date: 2023-06-29T18:03:47-07:00
New Revision: e962fa771246262043d057b1f16f262cd7b74c59

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

LOG: [OpenMPOpt][FIX] Internalization is an IR change too

The bots reported that we changed the IR w/o reporting it. The reason
was that internalization was not reported as changed. Forwarding the
result solves the problem.

Test coverage via
llvm/test/Transforms/Attributor/reduced/openmp_opt_constant_type_crash.ll

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index d75e62804ab43..70adee527ca47 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -5407,6 +5407,8 @@ PreservedAnalyses OpenMPOptPass::run(Module &M, ModuleAnalysisManager &AM) {
     });
   };
 
+  bool Changed = false;
+
   // Create internal copies of each function if this is a kernel Module. This
   // allows iterprocedural passes to see every call edge.
   DenseMap<Function *, Function *> InternalizedMap;
@@ -5422,7 +5424,8 @@ PreservedAnalyses OpenMPOptPass::run(Module &M, ModuleAnalysisManager &AM) {
         }
       }
 
-    Attributor::internalizeFunctions(InternalizeFns, InternalizedMap);
+    Changed |=
+        Attributor::internalizeFunctions(InternalizeFns, InternalizedMap);
   }
 
   // Look at every function in the Module unless it was internalized.
@@ -5435,7 +5438,7 @@ PreservedAnalyses OpenMPOptPass::run(Module &M, ModuleAnalysisManager &AM) {
     }
 
   if (SCC.empty())
-    return PreservedAnalyses::all();
+    return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();
 
   AnalysisGetter AG(FAM);
 
@@ -5468,7 +5471,7 @@ PreservedAnalyses OpenMPOptPass::run(Module &M, ModuleAnalysisManager &AM) {
   Attributor A(Functions, InfoCache, AC);
 
   OpenMPOpt OMPOpt(SCC, CGUpdater, OREGetter, InfoCache, A);
-  bool Changed = OMPOpt.run(true);
+  Changed |= OMPOpt.run(true);
 
   // Optionally inline device functions for potentially better performance.
   if (AlwaysInlineDeviceFunctions && isOpenMPDevice(M))


        


More information about the llvm-commits mailing list