Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, SeqStmt::Flatten could accept an arbitrary number of arguments, where each argument was of type const tir::Stmt& or an iterable. However, if SeqStmt::Flatten were passed a subclass of tir::Stmt, the templated overload was selected as the better match. This commit rewrites SeqStmt::Flatten using C++17's "constexpr if" feature, to handle cases of SeqStmt, superclasses of SeqStmt, and other subclasses of Stmt.

Prior to this commit, `SeqStmt::Flatten` could accept an arbitrary
number of arguments, where each argument was of type `const tir::Stmt&`
or an iterable.  However, if `SeqStmt::Flatten` were passed a subclass
of `tir::Stmt`, the templated overload was selected as the better
match.

This commit rewrites `SeqStmt::Flatten` using C++17's `"constexpr if"`
feature, to handle cases of `SeqStmt`, superclasses of `SeqStmt`, and
other subclasses of `Stmt`.
@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 4, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

@Lunderberg
Copy link
Contributor Author

This issue came up during development on #14486, but ended up not being needed for it.

@kparzysz-quic kparzysz-quic merged commit 287cd38 into apache:main Apr 5, 2023
@Lunderberg Lunderberg deleted the seqstmt_flatten_utility branch April 5, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants