Skip to content

Commit aed3836

Browse files
committed
[mlir][spirv] Remove nonlocal call verification.
`spirv.FunctionCall`'s verifier was being too aggressive. It included verification of non-local properties by looking at the callee's definition. This caused problems in cases where callee had verification errors and could lead to null pointer dereferencing. According to MLIR's developers guide TLDR: only verify local aspects of an operation, in particular don’t follow def-use chains (don’t look at the producer of any operand or the user of any results). https://mlir.llvm.org/getting_started/DeveloperGuide/#ir-verifier
1 parent e969bd7 commit aed3836

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,42 +160,12 @@ LogicalResult FunctionCallOp::verify() {
160160
<< fnName.getValue() << "' not found in nearest symbol table";
161161
}
162162

163-
auto functionType = funcOp.getFunctionType();
164-
165163
if (getNumResults() > 1) {
166164
return emitOpError(
167165
"expected callee function to have 0 or 1 result, but provided ")
168166
<< getNumResults();
169167
}
170168

171-
if (functionType.getNumInputs() != getNumOperands()) {
172-
return emitOpError("has incorrect number of operands for callee: expected ")
173-
<< functionType.getNumInputs() << ", but provided "
174-
<< getNumOperands();
175-
}
176-
177-
for (uint32_t i = 0, e = functionType.getNumInputs(); i != e; ++i) {
178-
if (getOperand(i).getType() != functionType.getInput(i)) {
179-
return emitOpError("operand type mismatch: expected operand type ")
180-
<< functionType.getInput(i) << ", but provided "
181-
<< getOperand(i).getType() << " for operand number " << i;
182-
}
183-
}
184-
185-
if (functionType.getNumResults() != getNumResults()) {
186-
return emitOpError(
187-
"has incorrect number of results has for callee: expected ")
188-
<< functionType.getNumResults() << ", but provided "
189-
<< getNumResults();
190-
}
191-
192-
if (getNumResults() &&
193-
(getResult(0).getType() != functionType.getResult(0))) {
194-
return emitOpError("result type mismatch: expected ")
195-
<< functionType.getResult(0) << ", but provided "
196-
<< getResult(0).getType();
197-
}
198-
199169
return success();
200170
}
201171

0 commit comments

Comments
 (0)