================
@@ -2076,6 +2076,11 @@ static void printConstant(OpAsmPrinter &p, Attribute 
value) {
 }
 
 mlir::LogicalResult cir::GlobalOp::verify() {
+  // A function is not an object, so it cannot be the type of a global.  A
+  // global that holds a function's address carries a pointer type instead.
+  if (mlir::isa<cir::FuncType>(getSymType()))
----------------
adams381 wrote:

You cannot get here with C/C++.  This was discovered when hand writing CIR for 
function pointer calling convention lowering support (that PR is going up soon).

It lowers to an `llvm.mlir.global` carrying a function type.  The LLVM dialect 
verifier accepts it and then LLVM IR translation aborts in the `GlobalVariable` 
constructor with no error message.

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

Reply via email to