Skip to content

Commit edea26a

Browse files
committed
Address review comments.
1 parent 8de9edd commit edea26a

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

flang/test/Integration/amdgpu/debug-target-var.f90

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
! RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-llvm -fopenmp -fopenmp-is-target-device -debug-info-kind=standalone %s -o - | FileCheck %s
1+
! RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-llvm -fopenmp -fopenmp-is-target-device -debug-info-kind=standalone %s -o - | FileCheck %s
22

33
subroutine fff(x, y)
44
implicit none
@@ -12,10 +12,16 @@ subroutine fff(x, y)
1212

1313
end subroutine fff
1414

15-
!CHECK: define{{.*}}amdgpu_kernel void @[[FN:[0-9a-zA_Z_]+]]({{.*}}){{.*}}!dbg ![[SP:[0-9]+]]
16-
!CHECK: #dbg_declare({{.*}}, ![[X:[0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(ptr), DIOpDeref(ptr)), {{.*}})
17-
!CHECK: #dbg_declare({{.*}}, ![[Y:[0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(ptr), DIOpDeref(ptr)), {{.*}})
18-
!CHECK: }
15+
! CHECK: define{{.*}}amdgpu_kernel void @[[FN:[0-9a-zA_Z_]+]](ptr %0, ptr %[[ARG1:[0-9]+]], ptr %[[ARG2:[0-9]+]]){{.*}}!dbg ![[SP:[0-9]+]]
16+
! CHECK-DAG: store ptr %[[ARG1]], ptr %[[CAST1:[0-9]+]]{{.*}}
17+
! CHECK-DAG: %[[CAST1]] = addrspacecast ptr addrspace(5) %[[AL1:[0-9]+]]
18+
! CHECK-DAG: %[[AL1]] = alloca{{.*}}
19+
! CHECK-DAG: store ptr %[[ARG2]], ptr %[[CAST2:[0-9]+]]{{.*}}
20+
! CHECK-DAG: %[[CAST2]] = addrspacecast ptr addrspace(5) %[[AL2:[0-9]+]]
21+
! CHECK-DAG: %[[AL2]] = alloca{{.*}}
22+
! CHECK-DAG: #dbg_declare(ptr %[[CAST1]], ![[X:[0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(ptr), DIOpDeref(ptr)), {{.*}})
23+
! CHECK-DAG: #dbg_declare(ptr %[[CAST2]], ![[Y:[0-9]+]], !DIExpression(DIOpArg(0, ptr addrspace(5)), DIOpDeref(ptr), DIOpDeref(ptr)), {{.*}})
24+
! CHECK: }
1925

2026
! CHECK-DAG: ![[SP]] = {{.*}}!DISubprogram(name: "[[FN]]"{{.*}})
2127
! CHECK-DAG: ![[X]] = !DILocalVariable(name: "x", arg: 2, scope: ![[SP]]{{.*}}type: ![[INT:[0-9]+]])

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7037,13 +7037,13 @@ static void FixupDebugInfoForOutlinedFunction(
70377037
// snippet) as location of variable. The AMDGPU backend drops the debug
70387038
// info for variable in such cases. So we change the location to alloca
70397039
// instead.
7040-
bool passByRef = false;
7040+
bool PassByRef = false;
70417041
llvm::Type *locType = nullptr;
70427042
for (auto Loc : DR->location_ops()) {
70437043
locType = Loc->getType();
70447044
if (llvm::LoadInst *Load = dyn_cast<llvm::LoadInst>(Loc)) {
70457045
DR->replaceVariableLocationOp(Loc, Load->getPointerOperand());
7046-
passByRef = true;
7046+
PassByRef = true;
70477047
}
70487048
}
70497049
// Add DIOps based expression. Note that we generate an extra indirection
@@ -7060,8 +7060,8 @@ static void FixupDebugInfoForOutlinedFunction(
70607060
// This is similar to what clang does.
70617061
// 2. Use double indirection and keep the original type. It will show up
70627062
// in debugger as "x=5". This approached is used here as it is
7063-
// consisten with the normal fortran parameters display.
7064-
if (passByRef)
7063+
// consistent with the normal fortran parameters display.
7064+
if (PassByRef)
70657065
ExprBuilder.append<llvm::DIOp::Deref>(Builder.getPtrTy(defaultAS));
70667066
ExprBuilder.append<llvm::DIOp::Deref>(locType);
70677067
DR->setExpression(ExprBuilder.intoExpression());

0 commit comments

Comments
 (0)