This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP]Fix overlapped mapping for dereferenced pointer members.
ClosedPublic

Authored by ABataev on Jul 7 2021, 10:33 AM.

Details

Summary

If the base is used in a map clause and later we have a memberexpr with
this base, and the member is a pointer, and this pointer is dereferenced
anyhow (subscript, array section, dereference, etc.), such components
should be considered as overlapped, otherwise it may lead to incorrect
size computations, since we try to map a pointee as a part of the whole
struct, which is not true for the pointer members.

Diff Detail

Event Timeline

ABataev created this revision.Jul 7 2021, 10:33 AM
ABataev requested review of this revision.Jul 7 2021, 10:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2021, 10:33 AM
Herald added a subscriber: sstefan1. · View Herald Transcript
jyu2 accepted this revision.Jul 8 2021, 9:42 PM

This will eliminate some IRS and it works okay with me. Thanks! But I don't know enough about this domain, please wait for some time to see if others may command on it.

clang/test/OpenMP/target_map_codegen_29.cpp
86

So instead generate map for individual pointer field, just generate one for each base with whole struct size. Make sense.

This revision is now accepted and ready to land.Jul 8 2021, 9:42 PM
ABataev updated this revision to Diff 357532.Jul 9 2021, 8:52 AM

Rebase + added runtime test intended to be fixed by the patch.

Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2021, 8:52 AM
abhinavgaba accepted this revision.Jul 9 2021, 12:47 PM

Thanks for the fix, Alexey.

This revision was landed with ongoing or failed builds.Jul 9 2021, 12:52 PM
This revision was automatically updated to reflect the committed changes.