[Mlir-commits] [flang] [mlir] [mlir] add option to print SSA IDs using `NameLoc`s as prefixes (PR #119996)

Jacques Pienaar llvmlistbot at llvm.org
Tue Dec 17 06:52:05 PST 2024


================
@@ -1398,6 +1398,24 @@ $ tree /tmp/pipeline_output
 │   │   ├── 1_1_pass4.mlir
 ```
 
+*   `mlir-use-nameloc-as-prefix`
+    * If your source IR has named locations (`loc("named_location")"`) then passing this flag will use those
+      names (`named_location`) to prefix the corresponding SSA identifiers:
+      ```
+      %1 = memref.load %0[] : memref<i32> loc("alice")  
+      %2 = memref.load %0[] : memref<i32> loc("bob")
+      %3 = memref.load %0[] : memref<i32> loc("bob")
+      ```
+      will print 
+      ```
+      %alice = memref.load %0[] : memref<i32>
+      %bob = memref.load %0[] : memref<i32>
+      %bob_0 = memref.load %0[] : memref<i32>
+      ```
+      These names will also be preserved through passes to newly created operations 
----------------
jpienaar wrote:

s/(assuming/if/

using the appropriate location.

Yes, there are some weasel words here, but there isn't necessarily one single location in all cases that should be passed (different users could have different opinions for valid reasons).

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


More information about the Mlir-commits mailing list