Yes, locations can be helpful for understanding the relationship between the original source, and the processed source. However, I believe that locations still require cross-referencing on the part of the developer, and thus I can imagine situations where say the output retaining the original names would be more helpful (since it reduces the need to manually cross-reference). Maybe I could get an implementation of identifier retention by using location information, but my experience thus far with that side of things suggests that might not be the way (e.g., the column numbers don’t always match up with what I’m looking for)
I’m still hammering out the design of the mlir-format tool (I have an initial version of comment retention working at time of writing). Initially, I’m going through the whole IR generation stage, which is more straightforward because it hooks in with the custom IR printers infrasturue already (I’m essentially just working with a modified mlir-opt right now). mlir-format stopping after parsing might make more sense design-wise, but perhaps that discussion is better suited for that thread.