================
@@ -38,7 +38,7 @@ class GPUModuleOp;
 } // namespace gpu
 
 namespace LLVM {
-class LLVMDialect;
+class CallOp;
----------------
eugeneepshteyn wrote:

(This comment was generated with the help of AI)

With `CallOp` only forward-declared here, every caller of 
`FunctionCallBuilder::create` now needs `LLVMControlFlowOps.h`, even one that 
ignores the result and never names an LLVM op. So "include the partition 
headers of the ops you use" does not cover this case for downstream code. This 
TU compiles at the base of this PR and fails with it:

```cpp
// x.cpp
#include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
void g(const mlir::FunctionCallBuilder &c, mlir::Location l, mlir::OpBuilder 
&b) { c.create(l, b, {}); }
```

```console
$ clang++ -std=c++17 -fsyntax-only <mlir/llvm include flags> x.cpp
x.cpp:3:86: error: calling 'create' with incomplete return type 'LLVM::CallOp'
```

Adding `#include "mlir/Dialect/LLVMIR/LLVMControlFlowOps.h"` fixes it. 
`BasicPtxBuilderInterface.h` has the same pattern with `InlineAsmOp`. In-tree 
users all compile, so this is about the migration note: could the description 
(or the LLVM dialect docs) say which header provides which ops, and mention the 
"incomplete return type" error for functions that return a forward-declared op?


https://github.com/llvm/llvm-project/pull/242307
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to