================
@@ -66,6 +66,17 @@ struct RemoveRedundantBranches : public 
OpRewritePattern<BrOp> {
   }
 };
 
+struct RemoveUnusedConstants : public OpRewritePattern<ConstantOp> {
----------------
andykaylor wrote:

What I was observing was that the general MLIR folding will only DCE operations 
that are otherwise modified during the folding process. If I fold something 
that causes the operation to become unused, the MLIR folding will remove it. 
However, if it is already unused on input, it does not get automatically 
removed. Apparently, the general folding is not checking the uses of every 
operation. However, after typing the previous statement, it occurred to me that 
just adding `ConstantOp` to the list of operations on which we apply folding 
greedily would be sufficient. I'll make that change.

https://github.com/llvm/llvm-project/pull/175675
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to