[llvm] 3a7cb3d - [OpenMP] Adjust generic state machine simplification CB

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 21:30:55 PDT 2023


Author: Johannes Doerfert
Date: 2023-03-27T21:30:23-07:00
New Revision: 3a7cb3d45ad2dce9c3f3e28ade9e0e534a6742d6

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

LOG: [OpenMP] Adjust generic state machine simplification CB

This callback caused us to potentially miss out on call edges if we were
expecting a custom state machine since the custom state machine was not
created but the workers also did not enter the generic one. I have not
observed an issue and don't know how to create a test for sure, but it
is saver to err on the conservative side for now.

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 e2d3aef240af..b2a545be941c 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -3501,22 +3501,7 @@ struct AAKernelInfoFunction : AAKernelInfo {
     Attributor::SimplifictionCallbackTy StateMachineSimplifyCB =
         [&](const IRPosition &IRP, const AbstractAttribute *AA,
             bool &UsedAssumedInformation) -> std::optional<Value *> {
-      // IRP represents the "use generic state machine" argument of an
-      // __kmpc_target_init call. We will answer this one with the internal
-      // state. As long as we are not in an invalid state, we will create a
-      // custom state machine so the value should be a `i1 false`. If we are
-      // in an invalid state, we won't change the value that is in the IR.
-      if (!ReachedKnownParallelRegions.isValidState())
         return nullptr;
-      // If we have disabled state machine rewrites, don't make a custom one.
-      if (DisableOpenMPOptStateMachineRewrite)
-        return nullptr;
-      if (AA)
-        A.recordDependence(*this, *AA, DepClassTy::OPTIONAL);
-      UsedAssumedInformation = !isAtFixpoint();
-      auto *FalseVal =
-          ConstantInt::getBool(IRP.getAnchorValue().getContext(), false);
-      return FalseVal;
     };
 
     Attributor::SimplifictionCallbackTy ModeSimplifyCB =


        


More information about the llvm-commits mailing list