Skip to content

Commit a35e2be

Browse files
committed
[OMPIRBuilder] Don't drop debug loc from LocationDescription.
LocationDescription contains both the instruction pointer and the debug location. When LocationDescription is available, it is better to use updateToLocation which will update both then restoreIP(Loc.IP) which may not. 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 82a276e commit a35e2be

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
@@ -5934,7 +5933,7 @@ OpenMPIRBuilder::createOrderedDepend(const LocationDescription &Loc,
59345933
Builder.restoreIP(AllocaIP);
59355934
AllocaInst *ArgsBase = Builder.CreateAlloca(ArrI64Ty, nullptr, Name);
59365935
ArgsBase->setAlignment(Align(8));
5937-
Builder.restoreIP(Loc.IP);
5936+
updateToLocation(Loc);
59385937

59395938
// Store the index value with offset in depend vector.
59405939
for (unsigned I = 0; I < NumLoops; ++I) {
@@ -8060,7 +8059,7 @@ void OpenMPIRBuilder::createMapperAllocas(const LocationDescription &Loc,
80608059
".offload_ptrs");
80618060
AllocaInst *ArgSizes = Builder.CreateAlloca(
80628061
ArrI64Ty, /* ArraySize = */ nullptr, ".offload_sizes");
8063-
Builder.restoreIP(Loc.IP);
8062+
updateToLocation(Loc);
80648063
MapperAllocas.ArgsBase = ArgsBase;
80658064
MapperAllocas.Args = Args;
80668065
MapperAllocas.ArgSizes = ArgSizes;

0 commit comments

Comments
 (0)