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

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 11:16:48 PST 2026


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

Btw as I did explaration of application of the canonicalization/folding thorughout clangir, as discussed yesterday, I believe it is worth just enabling folding in CIRCanonicalize pass on all CIR operations, so one does not need to add them explicitly all the time. I will look into this after your change, I have some draft of this change but it was changing too many test check, though it might take some time to get trough it.

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


More information about the cfe-commits mailing list