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

[Op] Support logical OR operation #89

Open
chhzh123 opened this issue Jun 21, 2022 · 0 comments
Open

[Op] Support logical OR operation #89

chhzh123 opened this issue Jun 21, 2022 · 0 comments
Assignees
Labels
MLIR Limitation MLIR limitations

Comments

@chhzh123
Copy link
Member

Logical AND is easy to implement using affine sets, but there are no corresponding operations in MLIR to write logical OR expressions in if condition. Considering if (cond1 || cond2) foo();, there are two possible solutions to rewrite:

  1. Use cascaded if operation, which requires copying the then block multiple times.
if (cond1) {
  foo();
} else if (cond2) {
  foo();
} else {
  // do nothing
}
  1. Use NOT operation to transform the condition into AND form, but this requires implementing the NOT operation and negating the conditions. The short circuit property also does not preserve [Op] SelectOp short-circuit evaluation #65.
if (!(!cond1 && !cond2))
  foo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MLIR Limitation MLIR limitations
Projects
None yet
Development

No branches or pull requests

1 participant