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

Mehdi Amini llvmlistbot at llvm.org
Wed Dec 6 20:44:21 PST 2023


================
@@ -77,8 +109,10 @@ LogicalResult OperationFolder::tryToFold(Operation *op, bool *inPlaceUpdate) {
     // Check to see if we should rehoist, i.e. if a non-constant operation was
     // inserted before this one.
     Block *opBlock = op->getBlock();
-    if (&opBlock->front() != op && !isFolderOwnedConstant(op->getPrevNode()))
+    if (&opBlock->front() != op && !isFolderOwnedConstant(op->getPrevNode())) {
       op->moveBefore(&opBlock->front());
+      appendFoldedLocation(op, opBlock->getParent()->getLoc());
----------------
joker-eph wrote:

Not sure that makes sense to me: this is already a "folderOwnedConstant" and we just moved it up in the block

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


More information about the Mlir-commits mailing list