[clang] [CIR] Annotate AMDGPU printf ops with constant strings before lowering (PR #242111)

Steffen Larsen via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 00:17:07 PST 2026


================
@@ -16,58 +16,131 @@
 
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/IR/BuiltinOps.h"
+#include "mlir/IR/Matchers.h"
 #include "clang/CIR/Dialect/IR/CIRDialect.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SparseBitVector.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/TargetParser/Triple.h"
 #include "llvm/Transforms/Utils/AMDGPUEmitPrintf.h"
 
 namespace cir {
 namespace direct {
 
 namespace {
 
+// One entry per operand, format first. A string entry means the
+// operand is a constant string; a unit entry means it is not.
+constexpr llvm::StringLiteral kPrintfConstStringsAttrName =
+    "cir.printf.const_strings";
----------------
steffenlarsen wrote:

Is this something we should place in CIRDialect?

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


More information about the cfe-commits mailing list