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

Billy Zhu llvmlistbot at llvm.org
Wed Dec 20 15:14:40 PST 2023


================
@@ -318,6 +327,7 @@ OperationFolder::tryGetOrCreateConstant(ConstantMap &uniquedConstants,
     notifyRemoval(constOp);
     rewriter.eraseOp(constOp);
     referencedDialects[existingOp].push_back(dialect);
+    existingOp->setLoc(erasedFoldedLocation);
----------------
zyx-billy wrote:

Actually, in practice it doesn't really make a difference since the only two callers of this private function `tryGetOrCreateConstant` already set the insertion point to the beginning of a block before calling it, so they should already know to ask for an erased location otherwise it's not going to work.

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


More information about the Mlir-commits mailing list