[clang] [CIR] Add support for the IdiomRecognizer pass (PR #208854)

Hendrik Hübner via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 11 09:17:31 PDT 2026


================
@@ -2251,11 +2252,33 @@ void LoweringPreparePass::lowerStoreOfConstAggregate(cir::StoreOp op) {
     constOp.erase();
 }
 
+// Raised ops carry the original callee and its call attributes, so lowering
+// them back rebuilds an equivalent plain call.
+static void restoreCallAttrs(cir::CallOp call, mlir::Operation *raised) {
+  for (mlir::NamedAttribute attr : raised->getAttrs())
+    if (attr.getName() != "original_fn")
+      call->setAttr(attr.getName(), attr.getValue());
+}
+
+void LoweringPreparePass::lowerStdFindOp(cir::StdFindOp op) {
----------------
HendrikHuebner wrote:

Could all StdOps be lowered like this by default? Otherwise, I imagine this function will be duplicated quite often once more operations are added.

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


More information about the cfe-commits mailing list