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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Feb 7 08:48:07 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()) {
----------------
abidh wrote:

I don't think BB will be unconnected. But even if that was to happen, the worst we will do is to drop debug bits as we are already doing. 

Thanks for pointing out the style bit. Corrected now.

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


More information about the Mlir-commits mailing list