[clang] [CIR] Add support for the IdiomRecognizer pass (PR #208854)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 07:19:17 PDT 2026
================
@@ -1,2 +1,47 @@
// RUN: %clang_cc1 -fclangir -emit-cir -mmlir --mlir-print-ir-after-all -clangir-enable-idiom-recognizer %s -o %t.cir 2>&1 | FileCheck %s -check-prefix=CIR
// CIR: IR Dump After IdiomRecognizer: cir-idiom-recognizer
+
+// 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 @_ZSt4findIPccET_S1_S1_RKT0_'
+// RUN: FileCheck %s --check-prefix=FINAL --input-file=%t.cir
+
+namespace std {
+template <class Iter, class T>
+__attribute__((pure)) Iter find(Iter, Iter, const T &) noexcept;
----------------
erichkeane wrote:
Doesn't libcxx use an inline namespace here too? Can we have a test that validates those uses?
Also, can we look and see what MSVC's STL does to make sure we have a pattern that shows that IT works?
Also, what about a `std::another_ns::find` where `another_ns` is not inline? We should also probably check `anonymous` namespaces here too.
https://github.com/llvm/llvm-project/pull/208854
More information about the cfe-commits
mailing list