[Mlir-commits] [mlir] [MLIR] Flatten fused locations when merging constants. (PR #75218)
Billy Zhu
llvmlistbot at llvm.org
Tue Dec 12 10:15:18 PST 2023
================
@@ -331,6 +331,34 @@ OperationFolder::tryGetOrCreateConstant(ConstantMap &uniquedConstants,
return newIt.first->second;
}
+namespace {
+
+/// Helper that flattens nested fused locations to a single fused location.
+/// Fused locations nested under non-fused locations are not flattened, and
+/// calling this on non-fused locations is a no-op as a result. The metadata
+/// of the outer fused location is retained in the result.
+Location FlattenFusedLocationRecursively(const Location loc) {
----------------
zyx-billy wrote:
Thanks for the fix! I think it looks good, just one comment.
Would it still solve your problem if this function only flattens when the metadata is identical? For string tags it may not matter as much, but there are cases where the metadata contains information that later passes rely on (e.g. debug information for dwarf) that cannot be dropped.
https://github.com/llvm/llvm-project/pull/75218
More information about the Mlir-commits
mailing list