Skip to content

Commit 335dbba

Browse files
authored
[OMPIRBuilder] Don't drop debug loc from LocationDescription. (#148713)
`LocationDescription` contains both the insertion point and the debug location. When `LocationDescription` is available, it is better to use `updateToLocation` which will update both. This PR replaces `restoreIP(Loc.IP)` with `updateToLocation(Loc)` as former may not update debug location in all cases. I am not checking the return value of `updateToLocation` because that is checked just a few lines above in all cases and we would have returned early if it failed.
1 parent 875491f commit 335dbba

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::emitTargetKernel(
11611161
Builder.restoreIP(AllocaIP);
11621162
auto *KernelArgsPtr =
11631163
Builder.CreateAlloca(OpenMPIRBuilder::KernelArgs, nullptr, "kernel_args");
1164-
Builder.restoreIP(Loc.IP);
1164+
updateToLocation(Loc);
11651165

11661166
for (unsigned I = 0, Size = KernelArgs.size(); I != Size; ++I) {
11671167
llvm::Value *Arg =
@@ -1189,7 +1189,6 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::emitKernelLaunch(
11891189
if (!updateToLocation(Loc))
11901190
return Loc.IP;
11911191

1192-
Builder.restoreIP(Loc.IP);
11931192
// On top of the arrays that were filled up, the target offloading call
11941193
// takes as arguments the device id as well as the host pointer. The host
11951194
// pointer is used by the runtime library to identify the current target
@@ -5955,7 +5954,7 @@ OpenMPIRBuilder::createOrderedDepend(const LocationDescription &Loc,
59555954
Builder.restoreIP(AllocaIP);
59565955
AllocaInst *ArgsBase = Builder.CreateAlloca(ArrI64Ty, nullptr, Name);
59575956
ArgsBase->setAlignment(Align(8));
5958-
Builder.restoreIP(Loc.IP);
5957+
updateToLocation(Loc);
59595958

59605959
// Store the index value with offset in depend vector.
59615960
for (unsigned I = 0; I < NumLoops; ++I) {
@@ -8081,7 +8080,7 @@ void OpenMPIRBuilder::createMapperAllocas(const LocationDescription &Loc,
80818080
".offload_ptrs");
80828081
AllocaInst *ArgSizes = Builder.CreateAlloca(
80838082
ArrI64Ty, /* ArraySize = */ nullptr, ".offload_sizes");
8084-
Builder.restoreIP(Loc.IP);
8083+
updateToLocation(Loc);
80858084
MapperAllocas.ArgsBase = ArgsBase;
80868085
MapperAllocas.Args = Args;
80878086
MapperAllocas.ArgSizes = ArgSizes;

0 commit comments

Comments
 (0)