Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Arith][Refactor] Return Optional<PrimExpr> from TryConstFold #12784

Merged

Conversation

Lunderberg
Copy link
Contributor

@Lunderberg Lunderberg commented Sep 14, 2022

Prior to this commit, the templated TryConstFold utility returned an undefined PrimExpr to represent a failure to perform constant folding. This commit makes this explicit by returning Optional<PrimExpr> instead.

cc @junrushao1994

Prior to this commit, the templated `TryConstFold` utility returned an
undefined `PrimExpr` to represent a failure to perform constant
folding.  This commit makes this explicit by returning
`Optional<PrimExpr>` instead.
@Lunderberg
Copy link
Contributor Author

From a brief look at the commit history, TryConstFold was introduced in #2719, significantly predating the introduction of Optional in #5314.

Copy link
Contributor

@wrongtest-intellif wrongtest-intellif left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wrongtest-intellif wrongtest-intellif merged commit 397cf87 into apache:main Sep 15, 2022
@Lunderberg Lunderberg deleted the const_fold_return_optional branch September 15, 2022 13:17
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
…#12784)

Prior to this commit, the templated `TryConstFold` utility returned an
undefined `PrimExpr` to represent a failure to perform constant
folding.  This commit makes this explicit by returning
`Optional<PrimExpr>` instead.
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.

2 participants