Skip to content

Conversation

@fabianmcg
Copy link
Contributor

This patch switches the return type in MemorySpaceAttrInterface methods from LogicalResult to bool. As is* methods are predicates.

Users of the MemorySpaceAttrInterface API must note that, if emitError is non-null and the result of a is* method is false, then an error was likely emitted. To avoid the emission of an error the user can pass a default constructed emitError.

…face`

This patch switches the return type in `MemorySpaceAttrInterface` methods from `LogicalResult` to `bool`.
As `is*` methods are predicates.

Users of the `MemorySpaceAttrInterface` API must note that, if `emitError` is non-null and the result
of a `is*` method is `false`, then an error was likely emitted. To avoid the emission of an error
the user can pass a default constructed `emitError`.
@fabianmcg fabianmcg requested a review from joker-eph April 27, 2025 12:45
@llvmbot llvmbot added the mlir label Apr 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 27, 2025

@llvm/pr-subscribers-mlir

Author: Fabian Mora (fabianmcg)

Changes

This patch switches the return type in MemorySpaceAttrInterface methods from LogicalResult to bool. As is* methods are predicates.

Users of the MemorySpaceAttrInterface API must note that, if emitError is non-null and the result of a is* method is false, then an error was likely emitted. To avoid the emission of an error the user can pass a default constructed emitError.


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

3 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td (+20-8)
  • (modified) mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp (+12-12)
  • (modified) mlir/test/lib/Dialect/Test/TestAttributes.cpp (+16-15)
diff --git a/mlir/include/mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td b/mlir/include/mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td
index 3e9f99e0e1d6a..54efeb0bc0f9e 100644
--- a/mlir/include/mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td
+++ b/mlir/include/mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td
@@ -35,8 +35,10 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
         This method checks if it's valid to load a value from the memory space
         with a specific type, alignment, and atomic ordering.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidLoad",
       /*args=*/        (ins "::mlir::Type":$type,
                             "::mlir::ptr::AtomicOrdering":$ordering,
@@ -48,8 +50,10 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
         This method checks if it's valid to store a value in the memory space
         with a specific type, alignment, and atomic ordering.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidStore",
       /*args=*/        (ins "::mlir::Type":$type,
                             "::mlir::ptr::AtomicOrdering":$ordering,
@@ -61,8 +65,10 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
         This method checks if it's valid to perform an atomic operation in the
         memory space with a specific type, alignment, and atomic ordering.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidAtomicOp",
       /*args=*/        (ins "::mlir::ptr::AtomicBinOp":$op,
                             "::mlir::Type":$type,
@@ -76,8 +82,10 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
         in the memory space with a specific type, alignment, and atomic
         orderings.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidAtomicXchg",
       /*args=*/        (ins "::mlir::Type":$type,
                             "::mlir::ptr::AtomicOrdering":$successOrdering,
@@ -90,8 +98,10 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
         This method checks if it's valid to perform an `addrspacecast` op
         in the memory space.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidAddrSpaceCast",
       /*args=*/        (ins "::mlir::Type":$tgt,
                             "::mlir::Type":$src,
@@ -101,11 +111,13 @@ def MemorySpaceAttrInterface : AttrInterface<"MemorySpaceAttrInterface"> {
       /*desc=*/        [{
         This method checks if it's valid to perform a `ptrtoint` or `inttoptr`
         op in the memory space.
-        The first type is expected to be integer-like, while the second must be a
-        ptr-like type.
+        The first type is expected to be integer-like, while the second must be
+        a ptr-like type.
         If `emitError` is non-null then the method is allowed to emit errors.
+        Furthermore, if `emitError` is non-null and the result is `false` an
+        error must have been emitted.
       }],
-      /*returnType=*/  "::mlir::LogicalResult",
+      /*returnType=*/  "bool",
       /*methodName=*/  "isValidPtrIntCast",
       /*args=*/        (ins "::mlir::Type":$intLikeTy,
                             "::mlir::Type":$ptrLikeTy,
diff --git a/mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp b/mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp
index 1770e4febf099..b819f56841852 100644
--- a/mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp
+++ b/mlir/lib/Dialect/Ptr/IR/PtrAttrs.cpp
@@ -23,45 +23,45 @@ constexpr const static unsigned kBitsInByte = 8;
 // GenericSpaceAttr
 //===----------------------------------------------------------------------===//
 
-LogicalResult GenericSpaceAttr::isValidLoad(
+bool GenericSpaceAttr::isValidLoad(
     Type type, ptr::AtomicOrdering ordering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return success();
+  return true;
 }
 
-LogicalResult GenericSpaceAttr::isValidStore(
+bool GenericSpaceAttr::isValidStore(
     Type type, ptr::AtomicOrdering ordering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return success();
+  return true;
 }
 
-LogicalResult GenericSpaceAttr::isValidAtomicOp(
+bool GenericSpaceAttr::isValidAtomicOp(
     ptr::AtomicBinOp op, Type type, ptr::AtomicOrdering ordering,
     IntegerAttr alignment, function_ref<InFlightDiagnostic()> emitError) const {
-  return success();
+  return true;
 }
 
-LogicalResult GenericSpaceAttr::isValidAtomicXchg(
+bool GenericSpaceAttr::isValidAtomicXchg(
     Type type, ptr::AtomicOrdering successOrdering,
     ptr::AtomicOrdering failureOrdering, IntegerAttr alignment,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return success();
+  return true;
 }
 
-LogicalResult GenericSpaceAttr::isValidAddrSpaceCast(
+bool GenericSpaceAttr::isValidAddrSpaceCast(
     Type tgt, Type src, function_ref<InFlightDiagnostic()> emitError) const {
   // TODO: update this method once the `addrspace_cast` op is added to the
   // dialect.
   assert(false && "unimplemented, see TODO in the source.");
-  return failure();
+  return false;
 }
 
-LogicalResult GenericSpaceAttr::isValidPtrIntCast(
+bool GenericSpaceAttr::isValidPtrIntCast(
     Type intLikeTy, Type ptrLikeTy,
     function_ref<InFlightDiagnostic()> emitError) const {
   // TODO: update this method once the int-cast ops are added to the dialect.
   assert(false && "unimplemented, see TODO in the source.");
-  return failure();
+  return false;
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
index 057d9fb4a215f..3524e85c2d234 100644
--- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
@@ -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;
 }
 
-LogicalResult TestConstMemorySpaceAttr::isValidAddrSpaceCast(
+bool TestConstMemorySpaceAttr::isValidAddrSpaceCast(
     Type tgt, Type src, function_ref<InFlightDiagnostic()> emitError) const {
-  return emitError
-             ? (emitError() << "memory space doesn't allow addrspace casts")
-             : failure();
+  return emitError ? failed(emitError()
+                            << "memory space doesn't allow addrspace casts")
+                   : false;
 }
 
-LogicalResult TestConstMemorySpaceAttr::isValidPtrIntCast(
+bool TestConstMemorySpaceAttr::isValidPtrIntCast(
     Type intLikeTy, Type ptrLikeTy,
     function_ref<InFlightDiagnostic()> emitError) const {
-  return emitError ? (emitError() << "memory space doesn't allow int-ptr casts")
-                   : failure();
+  return emitError
+             ? failed(emitError() << "memory space doesn't allow int-ptr casts")
+             : false;
 }
 
 //===----------------------------------------------------------------------===//

@github-actions
Copy link

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Discourse for more information.

@fabianmcg fabianmcg merged commit e731342 into llvm:main Apr 27, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 27, 2025

LLVM Buildbot has detected a new failure on builder premerge-monolithic-windows running on premerge-windows-1 while building mlir at step 7 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/35/builds/9584

Here is the relevant piece of the build log for the reference
Step 7 (build-unified-tree) failure: build (failure)
...
[20/4155] Building CXX object tools\mlir\lib\Dialect\Ptr\IR\CMakeFiles\obj.MLIRPtrDialect.dir\PtrTypes.cpp.obj
[21/4155] Building CXX object lib\Object\CMakeFiles\LLVMObject.dir\IRSymtab.cpp.obj
[22/4155] Linking CXX static library lib\LLVMObject.lib
[23/4155] Building CXX object tools\mlir\lib\Dialect\Ptr\IR\CMakeFiles\obj.MLIRPtrDialect.dir\PtrDialect.cpp.obj
[24/4155] Linking CXX executable bin\llvm-ar.exe
[25/4155] Generating ../../bin/llvm-lib.exe
[26/4155] Linking CXX executable bin\llvm-ctxprof-util.exe
[27/4155] Generating ../../bin/llvm-ranlib.exe
[28/4155] Generating ../../bin/llvm-dlltool.exe
[29/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestAttributes.cpp.obj
FAILED: tools/mlir/test/lib/Dialect/Test/CMakeFiles/MLIRTestDialect.dir/TestAttributes.cpp.obj 
sccache C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 -DMLIR_INCLUDE_TESTS -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\mlir\test\lib\Dialect\Test -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test -Itools\mlir\include -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\include -Iinclude -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\llvm\include /DWIN32 /D_WINDOWS   /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2  -MD  /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestAttributes.cpp.obj /Fdtools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\MLIRTestDialect.pdb /FS -c C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(336): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidLoad(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidLoad(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(746): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidLoad'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(334): error C2371: 'test::TestConstMemorySpaceAttr::isValidLoad': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(746): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidLoad'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(342): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidStore(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidStore(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(747): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidStore'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(340): error C2371: 'test::TestConstMemorySpaceAttr::isValidStore': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(747): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidStore'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(350): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidAtomicOp(mlir::ptr::AtomicBinOp,mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidAtomicOp(mlir::ptr::AtomicBinOp,mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(748): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAtomicOp'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(348): error C2371: 'test::TestConstMemorySpaceAttr::isValidAtomicOp': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(748): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAtomicOp'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(359): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidAtomicXchg(mlir::Type,mlir::ptr::AtomicOrdering,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidAtomicXchg(mlir::Type,mlir::ptr::AtomicOrdering,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(749): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAtomicXchg'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(356): error C2371: 'test::TestConstMemorySpaceAttr::isValidAtomicXchg': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(749): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAtomicXchg'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(366): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidAddrSpaceCast(mlir::Type,mlir::Type,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidAddrSpaceCast(mlir::Type,mlir::Type,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(750): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAddrSpaceCast'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(365): error C2371: 'test::TestConstMemorySpaceAttr::isValidAddrSpaceCast': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(750): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidAddrSpaceCast'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(374): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidPtrIntCast(mlir::Type,mlir::Type,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidPtrIntCast(mlir::Type,mlir::Type,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(751): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidPtrIntCast'
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(372): error C2371: 'test::TestConstMemorySpaceAttr::isValidPtrIntCast': redefinition; different basic types
tools\mlir\test\lib\Dialect\Test\TestAttrDefs.h.inc(751): note: see declaration of 'test::TestConstMemorySpaceAttr::isValidPtrIntCast'
[30/4155] Generating VCSVersion.inc
[31/4155] Linking CXX executable bin\llvm-profdata.exe
[32/4155] Building CXX object tools\mlir\test\lib\Dialect\Bufferization\CMakeFiles\MLIRBufferizationTestPasses.dir\TestTensorLikeAndBufferLike.cpp.obj
[33/4155] Building CXX object lib\CodeGen\AsmPrinter\CMakeFiles\LLVMAsmPrinter.dir\AsmPrinter.cpp.obj
[34/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestDialectInterfaces.cpp.obj
[35/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestTraits.cpp.obj
[36/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestOps.cpp.obj
[37/4155] Building CXX object tools\mlir\test\lib\Dialect\DLTI\CMakeFiles\MLIRDLTITestPasses.dir\TestDataLayoutQuery.cpp.obj
[38/4155] Building CXX object tools\mlir\test\lib\Dialect\Func\CMakeFiles\MLIRFuncTestPasses.dir\TestDecomposeCallGraphTypes.cpp.obj
[39/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestTypes.cpp.obj
[40/4155] Building CXX object tools\mlir\test\lib\Analysis\CMakeFiles\MLIRTestAnalysis.dir\DataFlow\TestDenseBackwardDataFlowAnalysis.cpp.obj
[41/4155] Building CXX object tools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestDialect.cpp.obj
[42/4155] Building CXX object tools\mlir\test\lib\Conversion\FuncToLLVM\CMakeFiles\MLIRTestFuncToLLVM.dir\TestConvertFuncOp.cpp.obj

@fabianmcg
Copy link
Contributor Author

Could this be product of a dirty cache?
Because the error is:

FAILED: tools/mlir/test/lib/Dialect/Test/CMakeFiles/MLIRTestDialect.dir/TestAttributes.cpp.obj
sccache C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 -DMLIR_INCLUDE_TESTS -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools\mlir\test\lib\Dialect\Test -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test -Itools\mlir\include -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\include -Iinclude -IC:\ws\buildbot\premerge-monolithic-windows\llvm-project\llvm\include /DWIN32 /D_WINDOWS   /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -
 wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2  -MD  /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\TestAttributes.cpp.obj /Fdtools\mlir\test\lib\Dialect\Test\CMakeFiles\MLIRTestDialect.dir\MLIRTestDialect.pdb /FS -c C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp
C:\ws\buildbot\premerge-monolithic-windows\llvm-project\mlir\test\lib\Dialect\Test\TestAttributes.cpp(336): error C2556: 'bool test::TestConstMemorySpaceAttr::isValidLoad(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const': overloaded function differs only by return type from 'llvm::LogicalResult test::TestConstMemorySpaceAttr::isValidLoad(mlir::Type,mlir::ptr::AtomicOrdering,mlir::IntegerAttr,llvm::function_ref<mlir::InFlightDiagnostic (void)>) const'

However, this patch changed both to bool and all other CIs are passing.

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…rface` (llvm#137513)

This patch switches the return type in `MemorySpaceAttrInterface`
methods from `LogicalResult` to `bool`. As `is*` methods are predicates.

Users of the `MemorySpaceAttrInterface` API must note that, if
`emitError` is non-null and the result of a `is*` method is `false`,
then an error was likely emitted. To avoid the emission of an error the
user can pass a default constructed `emitError`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants