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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 11:48:29 PDT 2026


================
@@ -8,10 +8,24 @@
 // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -clangir-enable-idiom-recognizer -emit-cir -mmlir --mlir-print-ir-after=cir-idiom-recognizer %s -o %t.cir 2>&1 | FileCheck %s --check-prefix=RAISED '--implicit-check-not=cir.call @_ZSt4find'
 // RUN: FileCheck %s --check-prefix=FINAL --input-file=%t.cir --implicit-check-not=cir.std.
 
+// On targets where plain char is unsigned the pointer lowers to !u8i, and
+// recognition works the same.
+// RUN: %clang_cc1 -std=c++17 -triple aarch64-unknown-linux-gnu -fno-signed-char -fclangir -clangir-enable-idiom-recognizer -emit-cir -mmlir --mlir-print-ir-after=cir-idiom-recognizer %s -o %t.aarch64.cir 2>&1 | FileCheck %s --check-prefix=RAISED
+
+// A no builtin list for another function survives the round trip on the
+// rebuilt call.
+// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fno-builtin-memcpy -fclangir -clangir-enable-idiom-recognizer -emit-cir %s -o %t.fnb.cir
+// RUN: FileCheck %s --check-prefix=FNB --input-file=%t.fnb.cir
----------------
erichkeane wrote:

Can we do something other than FNB/NB?  Something more descriptive? 

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


More information about the cfe-commits mailing list