[clang] [CIR] Attempt to fold casts and unary ops during codegen (PR #175675)

Sirui Mu via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 06:32:36 PST 2026


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

It's a bit strange to have to define a pattern like this manually to DCE a constant op. MLIR should be able to eliminate such operations automatically during canonicalization.

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


More information about the cfe-commits mailing list