[Mlir-commits] [mlir] [MLIR] Fuse locations of hoisted / merged constants (PR #74670)

Billy Zhu llvmlistbot at llvm.org
Thu Dec 7 22:12:47 PST 2023


zyx-billy wrote:

> I looked at the LLVM revision, but I don't find the "parent op location" equivalent in MLIR here?

Ah, this happens inside the logic for `DILocation::getMergedLocation`. It returns a location with the nearest common scope of two locations if they share a common scope. For us, we don't have to do this immediately since we can use FusedLoc to keep track of both locations (at least, until when we have to lower into more DWARF-like representations, at which point we can do the same thing as LLVM here and extract the parent).

For hoisting too, instead of following LLVM and just using the location of the insertion point instruction, we can also make things clearer by using the location of the parent scope directly, since we always move to the front of the block. This way we can later tell that this op is part of the common setup of the parent scope. DWARF emitters can then use this to mark this op as part of the prologue if appropriate.

> It'll probably help to look at a dedicated revision with dedicated examples crafted to showcase this.

Sounds good. Let me split up the PR so it can be considered separately.

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


More information about the Mlir-commits mailing list