This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Migrate OpenMPOffloadMappingFlags from Clang CodeGen to OMPConstants
ClosedPublic

Authored by TIFitis on Dec 19 2022, 4:24 AM.

Details

Summary

This patch moves the OpenMPOffloadMappingFlags enum definiition from Clang codegen to OMPConstants.h

Diff Detail

Event Timeline

TIFitis created this revision.Dec 19 2022, 4:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 19 2022, 4:24 AM
TIFitis requested review of this revision.Dec 19 2022, 4:24 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 19 2022, 4:24 AM
TIFitis added inline comments.Dec 19 2022, 4:29 AM
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
193

I am not sure if this change is safe. It can be avoided by making OpenMPOffloadMappingFlags an enum class.

jdoerfert added inline comments.Dec 19 2022, 11:03 AM
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
193

Why do you need to change this enum at all?

TIFitis marked an inline comment as done.Dec 19 2022, 8:38 PM
TIFitis added inline comments.
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
193

Otherwise you'd have two declarations of LLVM_MARK_AS_BITMASK_ENUM in the same namespace which is an error ofc.

This is because they are both enums which spill the declarations to the enclosing namespace, I.e. llvm::omp

jdoerfert added inline comments.Dec 19 2022, 9:44 PM
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
193

But we are using that type in binary operations w/o cast. Does this change then not break existing code?

TIFitis marked 2 inline comments as done.Dec 21 2022, 12:09 AM
TIFitis added inline comments.
llvm/include/llvm/Frontend/OpenMP/OMPConstants.h
193

Going by the comments LLVM_MARK_AS_BITMASK_ENUM should be used to mark the largest individual enum, don't see any restrictions on it being used with multiple enum's in the same namespace.

check-all is also clean. I don't see any evidence of this being unsafe.

Changing OpenMPOffloadMappingFlags to enum class however, would be the safest thing to do but that would introduce a lot of ugly static_cast everywhere.

TIFitis updated this revision to Diff 486224.Jan 4 2023, 3:15 AM
TIFitis marked an inline comment as done.

Changed OpenMPOffloadMappingFlags from enum to enum class. This resolves the conflict with LLVM_MARK_AS_BITMASK_ENUM.

Can you please check why there are so many reformatted lines are part of this patch? Is the clang-format version up to date? Maybe it changed but we should only format the parts touched by the patch, hence git-clang-format HEAD~ rather than format everything.

TIFitis updated this revision to Diff 486360.Jan 4 2023, 12:02 PM

Fixed clang-format issues.

jdoerfert accepted this revision.Jan 4 2023, 1:29 PM

LG, thx

This revision is now accepted and ready to land.Jan 4 2023, 1:29 PM
TIFitis updated this revision to Diff 486787.Jan 6 2023, 2:52 AM

Fixed Windows build issues,

TIFitis updated this revision to Diff 487171.Jan 8 2023, 5:26 AM

Second attempt at fixing windows build issue.

TIFitis updated this revision to Diff 487179.Jan 8 2023, 6:08 AM

Missed the other llvm::find_if in previous revision. This should fix Windows build issues.

This revision was landed with ongoing or failed builds.Jan 8 2023, 8:46 AM
This revision was automatically updated to reflect the committed changes.