[clang] [CIR] Rewrite a raised std::find over bytes into memchr (PR #212355)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 06:19:35 PDT 2026


================
@@ -9,13 +9,37 @@
 #ifndef CIR_DIALECT_TRANSFORMS_PASSDETAIL_H
 #define CIR_DIALECT_TRANSFORMS_PASSDETAIL_H
 
+#include "mlir/IR/BuiltinAttributes.h"
 #include "mlir/IR/Dialect.h"
 #include "mlir/Pass/Pass.h"
+#include "clang/CIR/Dialect/IR/CIRDialect.h"
 #include "clang/CIR/Dialect/Passes.h"
 #include "llvm/ABI/TargetInfo.h"
 
 namespace cir {
-class CIRDialect;
+
+// A nobuiltin mark or list forbids `name`, and an empty list forbids all.
+inline bool noBuiltinsForbid(mlir::Operation *op, llvm::StringRef name) {
+  if (op->hasAttr(cir::CIRDialect::getNoBuiltinAttrName()))
+    return true;
+  auto noBuiltins = op->getAttrOfType<mlir::ArrayAttr>(
+      cir::CIRDialect::getNoBuiltinsAttrName());
----------------
erichkeane wrote:

The point was that you are checking the `noBuiltins` here, and returning `false` if it doesn't exist.  BUT in the function that calls this (`isNoBuiltin)` line 40 returns true already if it exists.  So nothing below line 27 here seems reachable? 

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


More information about the cfe-commits mailing list