[clang] [llvm] [mlir] [LLVM] Improve IR parsing and printing for target memory locations (PR #176968)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 3 08:02:46 PST 2026


================
@@ -2636,9 +2654,18 @@ std::optional<MemoryEffects> LLParser::parseMemoryAttr() {
     }
 
     Lex.Lex();
-    if (Loc) {
+    if (!Locs.empty()) {
       SeenLoc = true;
-      ME = ME.getWithModRef(*Loc, *MR);
+      for (const IRMemLocation &Loc : Locs) {
+        ME = ME.getWithModRef(Loc, *MR);
+        if (ME.isTargetMemLoc(Loc) && Locs.size() == 1)
+          SeenTargetLoc = true;
+      }
+      if (Locs.size() > 1 && SeenTargetLoc) {
+        tokError("target memory default access kind must be specified first");
----------------
nikic wrote:

Missing test for this error condition?

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


More information about the cfe-commits mailing list