[Mlir-commits] [mlir] [mlir-tblgen] Only create body for unpruned create (PR #166019)

Hsiang-Chieh Tsou llvmlistbot at llvm.org
Sat Nov 1 14:39:15 PDT 2025


================
@@ -2632,11 +2632,13 @@ void OpEmitter::genInlineCreateBody(
     interleaveComma(nonBuilderStateArgsList, nonBuilderStateArgsOS);
     nonBuilderStateArgs = ", " + nonBuilderStateArgs;
   }
-  cWithLoc->body() << llvm::formatv(inlineCreateBody, locParamName,
-                                    nonBuilderStateArgs,
-                                    opClass.getClassName());
-  cImplicitLoc->body() << llvm::formatv(inlineCreateBodyImplicitLoc,
-                                        nonBuilderStateArgs);
+  if (cWithLoc)
+    cWithLoc->body() << llvm::formatv(inlineCreateBody, locParamName,
+                                      nonBuilderStateArgs,
+                                      opClass.getClassName());
+  if (cImplicitLoc)
+    cImplicitLoc->body() << llvm::formatv(inlineCreateBodyImplicitLoc,
+                                          nonBuilderStateArgs);
----------------
hsjts0u wrote:

I'm honestly not sure, but it looks like the decls and defs are generated at the construction of the `OpEmitterClass` and the actual emit methods are methods of the class so I assume both are pruned. 

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


More information about the Mlir-commits mailing list