[Mlir-commits] [mlir] [mlir][ptr] Switch `LogicalResult` to `bool` in `MemorySpaceAttrInterrface` (PR #137513)

Mehdi Amini llvmlistbot at llvm.org
Sun Apr 27 06:19:29 PDT 2025


================
@@ -331,43 +331,44 @@ TestOpAsmAttrInterfaceAttr::getAlias(::llvm::raw_ostream &os) const {
 // TestConstMemorySpaceAttr
 //===----------------------------------------------------------------------===//
 
-LogicalResult TestConstMemorySpaceAttr::isValidLoad(
+bool TestConstMemorySpaceAttr::isValidLoad(
     Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return success();
+  return true;
 }
 
-LogicalResult TestConstMemorySpaceAttr::isValidStore(
+bool TestConstMemorySpaceAttr::isValidStore(
     Type type, mlir::ptr::AtomicOrdering ordering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return emitError ? (emitError() << "memory space is read-only") : failure();
+  return emitError ? failed(emitError() << "memory space is read-only") : false;
 }
 
-LogicalResult TestConstMemorySpaceAttr::isValidAtomicOp(
+bool TestConstMemorySpaceAttr::isValidAtomicOp(
     mlir::ptr::AtomicBinOp binOp, Type type, mlir::ptr::AtomicOrdering ordering,
     IntegerAttr alignment, function_ref<InFlightDiagnostic()> emitError) const {
-  return emitError ? (emitError() << "memory space is read-only") : failure();
+  return emitError ? failed(emitError() << "memory space is read-only") : false;
 }
 
-LogicalResult TestConstMemorySpaceAttr::isValidAtomicXchg(
+bool TestConstMemorySpaceAttr::isValidAtomicXchg(
     Type type, mlir::ptr::AtomicOrdering successOrdering,
     mlir::ptr::AtomicOrdering failureOrdering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return emitError ? (emitError() << "memory space is read-only") : failure();
+  return emitError ? failed(emitError() << "memory space is read-only") : false;
----------------
joker-eph wrote:

```suggestion
  if (emitError) emitError() << "memory space is read-only");
  return false;
```

https://github.com/llvm/llvm-project/pull/137513


More information about the Mlir-commits mailing list