[flang-commits] [llvm] [flang] [OpenMPIRBuilder] Don't drop debug info for target region. (PR #80692)

Johannes Doerfert via flang-commits flang-commits at lists.llvm.org
Tue Feb 6 08:32:08 PST 2024


================
@@ -5025,10 +5026,41 @@ static Function *createOutlinedFunction(
       ParameterTypes.push_back(Arg->getType());
   }
 
+  auto BB = Builder.GetInsertBlock();
+  auto M = BB->getModule();
   auto FuncType = FunctionType::get(Builder.getVoidTy(), ParameterTypes,
                                     /*isVarArg*/ false);
-  auto Func = Function::Create(FuncType, GlobalValue::InternalLinkage, FuncName,
-                               Builder.GetInsertBlock()->getModule());
+  auto Func =
+      Function::Create(FuncType, GlobalValue::InternalLinkage, FuncName, M);
+
+  // If there's a DISubprogram associated with current function, then
+  // generate one for the outlined function.
+  if (Function *parentFunc = BB->getParent()) {
----------------
jdoerfert wrote:

Do we expect this to be an unconnected BB at any point?
Here, and below, please use LLVM style. This is not MLIR.

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


More information about the flang-commits mailing list