[Mlir-commits] [mlir] 3878564 - [mlir] Use reinterpret cast to construct TypedValue from a pointer

Eugene Zhulenev llvmlistbot at llvm.org
Sun Jul 2 16:18:04 PDT 2023


Author: Eugene Zhulenev
Date: 2023-07-02T16:18:00-07:00
New Revision: 38785647121cef0adde4d3adbe5c5fe21b83d32b

URL: https://github.com/llvm/llvm-project/commit/38785647121cef0adde4d3adbe5c5fe21b83d32b
DIFF: https://github.com/llvm/llvm-project/commit/38785647121cef0adde4d3adbe5c5fe21b83d32b.diff

LOG: [mlir] Use reinterpret cast to construct TypedValue from a pointer

Value is not convertible to TypedValue<T>, use explicit constructor from a pointer

Differential Revision: https://reviews.llvm.org/D154313

Added: 
    

Modified: 
    mlir/include/mlir/IR/Value.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/Value.h b/mlir/include/mlir/IR/Value.h
index a8415ff780bce..51d4e366e4970 100644
--- a/mlir/include/mlir/IR/Value.h
+++ b/mlir/include/mlir/IR/Value.h
@@ -534,11 +534,11 @@ struct DenseMapInfo<mlir::detail::TypedValue<T>>
     : public DenseMapInfo<mlir::Value> {
   static mlir::detail::TypedValue<T> getEmptyKey() {
     void *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
-    return mlir::Value::getFromOpaquePointer(pointer);
+    return reinterpret_cast<mlir::detail::ValueImpl *>(pointer);
   }
   static mlir::detail::TypedValue<T> getTombstoneKey() {
     void *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
-    return mlir::Value::getFromOpaquePointer(pointer);
+    return reinterpret_cast<mlir::detail::ValueImpl *>(pointer);
   }
 };
 
@@ -578,7 +578,7 @@ struct PointerLikeTypeTraits<mlir::detail::TypedValue<T>>
     : public PointerLikeTypeTraits<mlir::Value> {
 public:
   static inline mlir::detail::TypedValue<T> getFromVoidPointer(void *pointer) {
-    return mlir::Value::getFromOpaquePointer(pointer);
+    return reinterpret_cast<mlir::detail::ValueImpl *>(pointer);
   }
 };
 


        


More information about the Mlir-commits mailing list