[Mlir-commits] [clang] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)

Nikita Popov llvmlistbot at llvm.org
Thu Feb 6 08:17:21 PST 2025


================
@@ -2293,9 +2318,21 @@ static bool upgradeOldMemoryAttribute(MemoryEffects &ME, uint64_t EncodedKind) {
   case bitc::ATTR_KIND_INACCESSIBLEMEM_ONLY:
     ME &= MemoryEffects::inaccessibleMemOnly();
     return true;
+  case bitc::ATTR_KIND_ERRNOMEMONLY:
+    ME &= MemoryEffects::errnoMemOnly();
+    return true;
   case bitc::ATTR_KIND_INACCESSIBLEMEM_OR_ARGMEMONLY:
     ME &= MemoryEffects::inaccessibleOrArgMemOnly();
     return true;
+  case bitc::ATTR_KIND_INACCESSIBLEMEM_OR_ERRNOMEMONLY:
+    ME &= MemoryEffects::inaccessibleOrErrnoMemOnly();
+    return true;
+  case bitc::ATTR_KIND_ARGMEM_OR_ERRNOMEMONLY:
+    ME &= MemoryEffects::argumentOrErrnoMemOnly();
+    return true;
+  case bitc::ATTR_KIND_INACCESSIBLEMEM_OR_ARGMEM_OR_ERRNOMEMONLY:
+    ME &= MemoryEffects::inaccessibleOrArgOrErrnoMemOnly();
+    return true;
----------------
nikic wrote:

As said, you don't need all of this upgrade code for attributes that never existed ... but you **do** need code to upgrade old MemoryEffects, where you need to copy Other to Errno.

A way to do that would be to add a version number to the high byte of the MemoryEffects bitcode encoding.

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


More information about the Mlir-commits mailing list