[llvm] [AArch64][Bitcode] Use target memory for SME state (PR #205829)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 06:19:57 PDT 2026


================
@@ -2471,12 +2472,24 @@ Error BitcodeReader::parseAttributeGroupBlock() {
                         MemoryEffects::argMemOnly(ArgMem) |
                         MemoryEffects::errnoMemOnly(OtherMem) |
                         MemoryEffects::otherMemOnly(OtherMem);
+              // Old versions dont have target memory location.
+              // It was represented as Inaccessible memory for AArch64.
+              if (BitcodeTargetTriple.isAArch64())
+                for (auto Loc : MemoryEffects::targetMemLocations())
+                  ME = ME.getWithModRef(Loc, InaccessibleMem);
               B.addMemoryAttr(ME);
             } else {
               // Construct the memory attribute directly from the encoded base
               // on newer versions.
-              B.addMemoryAttr(MemoryEffects::createFromIntValue(
-                  EncodedME & 0x00FFFFFFFFFFFFFFULL));
+              auto ME = MemoryEffects::createFromIntValue(
+                  EncodedME & 0x00FFFFFFFFFFFFFFULL);
+              // Only from Version=2 onwards target memory location exist.
+              // It was represented as Inaccessible memory for AArch64.
+              if (Version == 1 && BitcodeTargetTriple.isAArch64())
+                for (auto Loc : MemoryEffects::targetMemLocations())
+                  ME = ME.getWithModRef(
+                      Loc, ME.getModRef(IRMemLocation::InaccessibleMem));
----------------
paulwalker-arm wrote:

As above.

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


More information about the llvm-commits mailing list