[Mlir-commits] [mlir] [MLIR] Erase location of folded constants (PR #75415)

Billy Zhu llvmlistbot at llvm.org
Thu Dec 14 09:53:43 PST 2023


================
@@ -154,6 +154,7 @@ bool OperationFolder::insertKnownConstant(Operation *op, Attribute constValue) {
                                  !isFolderOwnedConstant(op->getPrevNode())))
     op->moveBefore(&insertBlock->front());
 
+  op->setLoc(erasedFoldedLocation);
----------------
zyx-billy wrote:

oh yes it comes down to two policies:
- Erase location when the folder "owns" it, or
- Erase location when the folder manipulates it (hoist it or deduplicate something else with it)

Since there's only one place where the folder "ingests" an existing op to own it, I thought tracking it early would make the logic simpler to maintain. I don't have a really strong preference though. Let me push a patch on top to erase late and we can choose. The benefit with the latter of course is for constants that are already at the top of a block, they're unaffected.

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


More information about the Mlir-commits mailing list