[clang] [CIR] Implement simple folding for unary operations (PR #174882)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 8 11:00:30 PST 2026
================
@@ -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>()) {
----------------
xlauko 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.
https://github.com/llvm/llvm-project/pull/174882
More information about the cfe-commits
mailing list