[clang] [llvm] [OpenMP] Ensure the actual kernel is annotated with launch bounds (PR #99927)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 13:21:46 PDT 2024


================
@@ -4569,7 +4569,17 @@ OpenMPIRBuilder::createTargetInit(const LocationDescription &Loc, bool IsSPMD,
   Constant *MayUseNestedParallelismVal = ConstantInt::getSigned(Int8, true);
   Constant *DebugIndentionLevelVal = ConstantInt::getSigned(Int16, 0);
 
-  Function *Kernel = Builder.GetInsertBlock()->getParent();
+  Function *DebugKernelWrapper = Builder.GetInsertBlock()->getParent();
+  Function *Kernel = DebugKernelWrapper;
+
+  // We need to strip the debug prefix to get the correct kernel name.
+  StringRef KernelName = Kernel->getName();
+  const std::string DebugPrefix = "_debug__";
+  if (KernelName.ends_with(DebugPrefix)) {
----------------
jhuber6 wrote:

Honestly, I don't think I ever understood what the wrapper was for in debug mode.

https://github.com/llvm/llvm-project/pull/99927


More information about the cfe-commits mailing list