[Mlir-commits] [mlir] 22aad0a - [mlir] Use llvm::to_underlying (NFC)

Kazu Hirata llvmlistbot at llvm.org
Wed Nov 1 21:39:47 PDT 2023


Author: Kazu Hirata
Date: 2023-11-01T21:39:41-07:00
New Revision: 22aad0ad36a434c5f3dd540b371175f4ebd34b62

URL: https://github.com/llvm/llvm-project/commit/22aad0ad36a434c5f3dd540b371175f4ebd34b62
DIFF: https://github.com/llvm/llvm-project/commit/22aad0ad36a434c5f3dd540b371175f4ebd34b62.diff

LOG: [mlir] Use llvm::to_underlying (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index 2bf9355ed62676b..3b792a26d1823fe 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -21,6 +21,7 @@
 #include "mlir/Interfaces/FoldInterfaces.h"
 
 #include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
@@ -668,10 +669,7 @@ static LogicalResult verifySynchronizationHint(Operation *op, uint64_t hint) {
 // Helper function to get bitwise AND of `value` and 'flag'
 uint64_t mapTypeToBitFlag(uint64_t value,
                           llvm::omp::OpenMPOffloadMappingFlags flag) {
-  return value &
-         static_cast<
-             std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
-             flag);
+  return value & llvm::to_underlying(flag);
 }
 
 /// Parses a map_entries map type from a string format back into its numeric
@@ -720,8 +718,7 @@ static ParseResult parseMapClause(OpAsmParser &parser, IntegerAttr &mapType) {
 
   mapType = parser.getBuilder().getIntegerAttr(
       parser.getBuilder().getIntegerType(64, /*isSigned=*/false),
-      static_cast<std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
-          mapTypeBits));
+      llvm::to_underlying(mapTypeBits));
 
   return success();
 }


        


More information about the Mlir-commits mailing list