Skip to content

Commit 9d77808

Browse files
authored
[OMPIRBuilder] Don't use invalid debug loc in task proxy function. (#148284)
This is similar to #147950 but for task proxy function.
1 parent 08a8e1c commit 9d77808

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7229,9 +7229,11 @@ static Function *emitTargetTaskProxyFunction(
72297229

72307230
bool HasShareds = SharedArgsOperandNo > 0;
72317231
bool HasOffloadingArrays = NumOffloadingArrays > 0;
7232+
IRBuilder<>::InsertPointGuard IPG(Builder);
72327233
BasicBlock *EntryBB =
72337234
BasicBlock::Create(Builder.getContext(), "entry", ProxyFn);
72347235
Builder.SetInsertPoint(EntryBB);
7236+
Builder.SetCurrentDebugLocation(llvm::DebugLoc());
72357237

72367238
SmallVector<Value *> KernelLaunchArgs;
72377239
KernelLaunchArgs.reserve(StaleCI->arg_size());
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
2+
3+
module attributes {omp.is_target_device = false} {
4+
llvm.func @omp_target_depend_() {
5+
%0 = llvm.mlir.constant(39 : index) : i64
6+
%1 = llvm.mlir.constant(1 : index) : i64
7+
%2 = llvm.mlir.constant(40 : index) : i64
8+
%3 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%0 : i64) extent(%2 : i64) stride(%1 : i64) start_idx(%1 : i64)
9+
%4 = llvm.mlir.addressof @_QFEa : !llvm.ptr
10+
%5 = omp.map.info var_ptr(%4 : !llvm.ptr, !llvm.array<40 x i32>) map_clauses(from) capture(ByRef) bounds(%3) -> !llvm.ptr {name = "a"}
11+
omp.target depend(taskdependin -> %4 : !llvm.ptr) map_entries(%5 -> %arg0 : !llvm.ptr) {
12+
%6 = llvm.mlir.constant(100 : index) : i32
13+
llvm.store %6, %arg0 : i32, !llvm.ptr
14+
omp.terminator
15+
} loc(#loc13)
16+
llvm.return
17+
} loc(#loc12)
18+
19+
llvm.mlir.global internal @_QFEa() {addr_space = 0 : i32} : !llvm.array<40 x i32> {
20+
%0 = llvm.mlir.zero : !llvm.array<40 x i32>
21+
llvm.return %0 : !llvm.array<40 x i32>
22+
}
23+
}
24+
25+
#loc1 = loc("test.f90":4:18)
26+
#loc2 = loc("test.f90":8:7)
27+
28+
#di_file = #llvm.di_file<"test.f90" in "">
29+
#di_null_type = #llvm.di_null_type
30+
#di_compile_unit = #llvm.di_compile_unit<id = distinct[0]<>,
31+
sourceLanguage = DW_LANG_Fortran95, file = #di_file, producer = "flang",
32+
isOptimized = false, emissionKind = LineTablesOnly>
33+
#di_subroutine_type = #llvm.di_subroutine_type<
34+
callingConvention = DW_CC_program, types = #di_null_type>
35+
#di_subprogram = #llvm.di_subprogram<id = distinct[1]<>,
36+
compileUnit = #di_compile_unit, scope = #di_file, name = "main",
37+
file = #di_file, subprogramFlags = "Definition|MainSubprogram",
38+
type = #di_subroutine_type>
39+
#di_subprogram1 = #llvm.di_subprogram<compileUnit = #di_compile_unit,
40+
name = "target", file = #di_file, subprogramFlags = "Definition",
41+
type = #di_subroutine_type>
42+
43+
44+
#loc12 = loc(fused<#di_subprogram>[#loc1])
45+
#loc13 = loc(fused<#di_subprogram1>[#loc2])
46+
47+
// CHECK: define internal void @.omp_target_task_proxy_func
48+
// CHECK-NOT: !dbg
49+
// CHECK: }

0 commit comments

Comments
 (0)