Skip to content

Commit 5244617

Browse files
committed
[OpenMP][NFC] Delete dead code
This code may have served a purpose at some point but it has been dead for a long while. `FromMapperBase` was always `nullptr` which is `false` which makes the rest of the code dead. Since this has not affected tests, I delete it for now.
1 parent 747af24 commit 5244617

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

openmp/libomptarget/src/omptarget.cpp

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -751,16 +751,13 @@ struct PostProcessingInfo {
751751
/// The mapping type (bitfield).
752752
int64_t ArgType;
753753

754-
/// Index of the argument in the data mapping scheme.
755-
int32_t ArgIndex;
756-
757754
/// The target pointer information.
758755
TargetPointerResultTy TPR;
759756

760757
PostProcessingInfo(void *HstPtr, int64_t Size, int64_t ArgType,
761-
int32_t ArgIndex, TargetPointerResultTy &&TPR)
758+
TargetPointerResultTy &&TPR)
762759
: HstPtrBegin(HstPtr), DataSize(Size), ArgType(ArgType),
763-
ArgIndex(ArgIndex), TPR(std::move(TPR)) {}
760+
TPR(std::move(TPR)) {}
764761
};
765762

766763
} // namespace
@@ -772,12 +769,10 @@ struct PostProcessingInfo {
772769
/// according to the successfulness of the operations.
773770
[[nodiscard]] static int
774771
postProcessingTargetDataEnd(DeviceTy *Device,
775-
SmallVector<PostProcessingInfo> &EntriesInfo,
776-
bool FromMapper) {
772+
SmallVector<PostProcessingInfo> &EntriesInfo) {
777773
int Ret = OFFLOAD_SUCCESS;
778-
void *FromMapperBase = nullptr;
779774

780-
for (auto &[HstPtrBegin, DataSize, ArgType, ArgIndex, TPR] : EntriesInfo) {
775+
for (auto &[HstPtrBegin, DataSize, ArgType, TPR] : EntriesInfo) {
781776
bool DelEntry = !TPR.isHostPointer();
782777

783778
// If the last element from the mapper (for end transfer args comes in
@@ -788,11 +783,6 @@ postProcessingTargetDataEnd(DeviceTy *Device,
788783
DelEntry = false; // protect parent struct from being deallocated
789784
}
790785

791-
if (DelEntry && FromMapper && ArgIndex == 0) {
792-
DelEntry = false;
793-
FromMapperBase = HstPtrBegin;
794-
}
795-
796786
// If we marked the entry to be deleted we need to verify no other
797787
// thread reused it by now. If deletion is still supposed to happen by
798788
// this thread LR will be set and exclusive access to the HDTT map
@@ -836,7 +826,7 @@ postProcessingTargetDataEnd(DeviceTy *Device,
836826
// TPR), or erase TPR.
837827
TPR.setEntry(nullptr);
838828

839-
if (!DelEntry || (FromMapperBase && FromMapperBase == HstPtrBegin))
829+
if (!DelEntry)
840830
continue;
841831

842832
Ret = Device->eraseMapEntry(HDTTMap, Entry, DataSize);
@@ -860,7 +850,6 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
860850
void **ArgMappers, AsyncInfoTy &AsyncInfo, bool FromMapper) {
861851
int Ret = OFFLOAD_SUCCESS;
862852
auto *PostProcessingPtrs = new SmallVector<PostProcessingInfo>();
863-
void *FromMapperBase = nullptr;
864853
// process each input.
865854
for (int32_t I = ArgNum - 1; I >= 0; --I) {
866855
// Ignore private variables and arrays - there is no mapping for them.
@@ -998,7 +987,7 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
998987
}
999988

1000989
// Add pointer to the buffer for post-synchronize processing.
1001-
PostProcessingPtrs->emplace_back(HstPtrBegin, DataSize, ArgTypes[I], I,
990+
PostProcessingPtrs->emplace_back(HstPtrBegin, DataSize, ArgTypes[I],
1002991
std::move(TPR));
1003992
PostProcessingPtrs->back().TPR.getEntry()->unlock();
1004993
}
@@ -1007,8 +996,7 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
1007996
// TODO: We might want to remove `mutable` in the future by not changing the
1008997
// captured variables somehow.
1009998
AsyncInfo.addPostProcessingFunction([=, Device = &Device]() mutable -> int {
1010-
return postProcessingTargetDataEnd(Device, *PostProcessingPtrs,
1011-
FromMapperBase);
999+
return postProcessingTargetDataEnd(Device, *PostProcessingPtrs);
10121000
});
10131001

10141002
return Ret;

0 commit comments

Comments
 (0)