[Mlir-commits] [mlir] [mlir][lR] Add Check For Functions with Zero Results in "test-func-erase-result" Pass (PR #127941)
Ayokunle Amodu
llvmlistbot at llvm.org
Wed Feb 25 14:00:12 PST 2026
ayokunle321 wrote:
> Sure. We also need a test that was crashing before your change and isn't now.
@joker-eph
The thing is that the test that was crashing before no longer crashes because this commit 7318074168e324097b7f6ec93e34915463bf70f1 which was after my initial patch. This had caused a function with no results to error out with the "failed to erase results" message instead of crashing. So the test is technically there already, but I would have to remove the error CHECK and have a comment saying the function is skipped instead.
Now I'm wondering if I could write a correct test (one that's not a function without results) that would still induce that error but none comes to mind.
This is the [culprit](https://github.com/llvm/llvm-project/blob/5cd6bb04e2d8b0712353a7dcd9729b217c35b12f/mlir/test/lib/IR/TestFunc.cpp#L112). In this case, `indicesToErase` is never set, and is also of size zero, so eraseResults returns a failure, i.e.,
```
::llvm::LogicalResult eraseResults(const ::llvm::BitVector &resultIndices) {
::mlir::Type newType = (*this).getTypeWithoutResults(resultIndices);
if (!newType)
return ::llvm::failure();
```
Do you have an idea for a test that would cause this? Or I should not worry about this for now.
https://github.com/llvm/llvm-project/pull/127941
More information about the Mlir-commits
mailing list