[clang] [OpenMP] Don't emit redundant zero-sized mapping nodes for overlapped structs (PR #148947)
Julian Brown via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 16 04:55:44 PDT 2025
================
@@ -7080,6 +7080,111 @@ class MappableExprsHandler {
return ConstLength.getSExtValue() != 1;
}
+ /// A helper class to copy structures with overlapped elements, i.e. those
+ /// which have mappings of both "s" and "s.mem". Consecutive elements that
+ /// are not explicitly copied have mapping nodes synthesized for them,
+ /// taking care to avoid generating zero-sized copies.
+ class CopyOverlappedEntryGaps {
+ CodeGenFunction &CGF;
+ MapCombinedInfoTy &CombinedInfo;
+ OpenMPOffloadMappingFlags Flags;
+ const ValueDecl *MapDecl;
+ const Expr *MapExpr;
+ Address BP;
+ bool IsNonContiguous;
+ uint64_t DimSize;
+ // These elements track the position as the struct is iterated over
+ // (in order of increasing element address).
+ const RecordDecl *LastParent = nullptr;
+ uint64_t Cursor = 0;
+ unsigned LastIndex = -1u;
+ Address LB;
+
+ public:
+ CopyOverlappedEntryGaps(CodeGenFunction &_CGF,
+ MapCombinedInfoTy &_CombinedInfo,
+ OpenMPOffloadMappingFlags _Flags,
+ const ValueDecl *_MapDecl, const Expr *_MapExpr,
+ Address _BP, Address _LB, bool _IsNonContiguous,
----------------
jtb20 wrote:
Fixed, thanks.
https://github.com/llvm/llvm-project/pull/148947
More information about the cfe-commits
mailing list