[Mlir-commits] [mlir] [MLIR] Add support for calling conventions to LLVM::CallOp and LLVM::InvokeOp (PR #71319)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Nov 5 08:20:15 PST 2023


================
@@ -1161,6 +1212,13 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
       return emitOpError() << "'" << calleeName.getValue()
                            << "' does not reference a valid LLVM function";
 
+    if (fn.getCConv() != getCConv()) {
+      auto fnCConv = stringifyCConv(fn.getCConv());
+      auto callCConv = stringifyCConv(getCConv());
+      return emitOpError() << "calling convention mismatch: " << callCConv
+                           << " != " << fnCConv;
+    }
----------------
Sirraide wrote:

> If optimizations managed to turn getCallee into a SymbolRefAttr the above program would suddenly cause verification failure despite never actually doing anything undefined.

Ah yeah, that’s a classic problem, and it makes sense why this is UB rather than invalid; in that case, I’ll also go ahead and remove the test case I added to `invalid.mlir`.

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


More information about the Mlir-commits mailing list