This is an archive of the discontinued LLVM Phabricator instance.

[mlir] allow empty region in transform::SequenceOp::getEffects
Needs RevisionPublic

Authored by python3kgae on Jan 22 2023, 8:30 PM.

Details

Summary

Fixes #60213 https://github.com/llvm/llvm-project/issues/60213
When region is empty, getBodyBlock should return nullptr.
And transform::SequenceOp::getEffects should not use the nullptr return from getBodyBlock.

Diff Detail

Event Timeline

python3kgae created this revision.Jan 22 2023, 8:30 PM
python3kgae requested review of this revision.Jan 22 2023, 8:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 22 2023, 8:31 PM
ftynse requested changes to this revision.Jan 23 2023, 1:39 AM
ftynse added inline comments.
mlir/test/IR/visitors.mlir
214

I don't this a change to the Transform dialect should be affecting test/IR/, which is really for core IR features. I understand this is how the buggy behavior was exposed originally, but we need to find a more suitable place. One trivial solution would be to just have this part of test under test/Dialect/Transform. We may also want to specifically exercise the memory effects rather than the visitor that feels a bit orthogonal.

This revision now requires changes to proceed.Jan 23 2023, 1:39 AM
python3kgae added inline comments.Jan 23 2023, 9:27 PM
mlir/test/IR/visitors.mlir
214

Is it OK to add an unit test for getBodyBlock on empty region to return nullptr?

And I saw many calls on getBodyBlock which assume it not return nullptr, shall I add check for all the calls of getBodyBlock?