================
@@ -424,6 +424,10 @@ LogicalResult cir::FuncOp::verifyType() {
   if (!isa<cir::FuncType>(type))
     return emitOpError("requires '" + getFunctionTypeAttrName().str() +
                        "' attribute of function type");
+  if (auto rt = type.getReturnTypes();
----------------
dkolsen-pgi wrote:

> `getFunctionType` already gives us a `cir::FuncType`, so an `isa` will always 
> be true, correct?

Correct.  I just noticed that myself, as I was looking at this function more 
closely.

In the incubator, this function has three checks.  The first is a tautology, 
because it is checking if a `cir::FuncType` `isa` `cir::FuncType`.  The second, 
which I had not upstreamed yet, is wrong.  It checks that an ellipsis is not 
the only parameter, but functions with only an ellipsis are allowed in C++.  
The third check, the one added in this PR, that there isn't an explicit `void` 
return type, is redundant, because that is already checked in 
`FuncType::verify`.

It doesn't look like `FuncOp::verifyType` is called from anywhere (even in the 
incubator), and it doesn't do anything useful.  So rather than adding a check 
for `rt.size() < 2` to the function, I will look into getting rid of it 
entirely.


https://github.com/llvm/llvm-project/pull/128787
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to