[NFC] Generically resolve body in FunctionOpInterface verifyBody.

Since the actual implementation class can arbitrarily shadow parts of the FunctionOpInterface exported API, access the body generically instead of via the use of the interface being defined.

Fixes https://github.com/llvm/llvm-project/issues/54807

Differential Revision: https://reviews.llvm.org/D123757
This commit is contained in:
Stella Laurenzo 2022-04-13 20:13:18 -07:00
parent 71d88b4ba8
commit 4f7585195d
1 changed files with 8 additions and 5 deletions

View File

@ -86,7 +86,10 @@ def FunctionOpInterface : OpInterface<"FunctionOpInterface"> {
if ($_op.isExternal())
return success();
ArrayRef<Type> fnInputTypes = $_op.getArgumentTypes();
Block &entryBlock = $_op.front();
// NOTE: This should just be $_op.front() but access generically
// because the interface methods defined here may be shadowed in
// arbitrary ways. https://github.com/llvm/llvm-project/issues/54807
Block &entryBlock = $_op->getRegion(0).front();
unsigned numArguments = fnInputTypes.size();
if (entryBlock.getNumArguments() != numArguments)