From a69ce0615bca5268e22d6a5b9e765899e7b9c726 Mon Sep 17 00:00:00 2001 From: Jan Leyonberg Date: Wed, 24 Jul 2024 08:18:17 -0400 Subject: [PATCH 1/2] [clang][OpenMP] Propoagate debug location to OMPIRBuilder reduction codegen This patch propagates the debug location from Clang to the OpenMPIRBuilder. Fixes #97428 --- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index fb71b27de9cd0..835662e6cd0a3 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -1652,6 +1652,7 @@ static llvm::Value *castValueToType(CodeGenFunction &CGF, llvm::Value *Val, /// Finally, a call is made to '__kmpc_nvptx_parallel_reduce_nowait_v2' to /// reduce across workers and compute a globally reduced value. /// + void CGOpenMPRuntimeGPU::emitReduction( CodeGenFunction &CGF, SourceLocation Loc, ArrayRef Privates, ArrayRef LHSExprs, ArrayRef RHSExprs, @@ -1694,7 +1695,8 @@ void CGOpenMPRuntimeGPU::emitReduction( CGF.AllocaInsertPt->getIterator()); InsertPointTy CodeGenIP(CGF.Builder.GetInsertBlock(), CGF.Builder.GetInsertPoint()); - llvm::OpenMPIRBuilder::LocationDescription OmpLoc(CodeGenIP); + llvm::OpenMPIRBuilder::LocationDescription OmpLoc( + CodeGenIP, CGF.SourceLocToDebugLoc(Loc)); llvm::SmallVector ReductionInfos; CodeGenFunction::OMPPrivateScope Scope(CGF); From 73a708fda64e2228f47cce097d1eefe2ee63283d Mon Sep 17 00:00:00 2001 From: Jan Leyonberg Date: Wed, 24 Jul 2024 08:24:38 -0400 Subject: [PATCH 2/2] Update clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp --- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index 835662e6cd0a3..df60e3abf145e 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -1652,7 +1652,6 @@ static llvm::Value *castValueToType(CodeGenFunction &CGF, llvm::Value *Val, /// Finally, a call is made to '__kmpc_nvptx_parallel_reduce_nowait_v2' to /// reduce across workers and compute a globally reduced value. /// - void CGOpenMPRuntimeGPU::emitReduction( CodeGenFunction &CGF, SourceLocation Loc, ArrayRef Privates, ArrayRef LHSExprs, ArrayRef RHSExprs,