[Mlir-commits] [mlir] [MLIR] Flatten fused locations when merging constants. (PR #75218)

Benjamin Chetioui llvmlistbot at llvm.org
Tue Dec 12 12:04:31 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) {
----------------
bchetioui wrote:

It seems to work for me by checking if there is either no metadata, or if the inner metadata is identical to the outer metadata. I pushed a new commit!

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


More information about the Mlir-commits mailing list