[clang] [CIR] Recognize strlen in the IdiomRecognizer pass (PR #210400)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 09:53:27 PDT 2026


================
@@ -50,4 +88,14 @@ def CIR_StdFindOp : CIR_StdOp<"find",
   }];
 }
 
+def CIR_StrLenOp : CIR_CStdLibOp<"strlen",
+  (ins CIR_PtrToChar8Type:$string),
+  (outs CIR_AnyFundamentalUIntType:$result)> {
----------------
erichkeane wrote:

I wonder if we should just do these analysis/function recognizing with the FE?  As a part of our 'lower function' we could decide if it is the 'right' function?  

It seems like a lot of extra work here to recognize these when the FE has the info.

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


More information about the cfe-commits mailing list