================
@@ -2479,6 +2479,39 @@ OpFoldResult cir::UnaryOp::fold(FoldAdaptor adaptor) {
       if (isBoolNot(previous))
         return previous.getInput();
 
+  // Fold constant unary operations.
+  if (auto srcConst = getInput().getDefiningOp<cir::ConstantOp>()) {
----------------
andykaylor wrote:

> I believe standarc MLIR canonicalize pass uses dead code analysis for 
> everythng once it is finished, so one does not need to do redundant clean up 
> implementation.

Near as I can tell, it only removes values that become dead during folding. If 
we introduce dead constants during codegen, we need to explicitly clean them up 
during our canonicalize pass or run a separate dead value elimination pass.

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

Reply via email to