[Op] Support logical OR operation
Opened this issue · 0 comments
chhzh123 commented
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:
- Use cascaded
if
operation, which requires copying thethen
block multiple times.
if (cond1) {
foo();
} else if (cond2) {
foo();
} else {
// do nothing
}
- 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 #65.
if (!(!cond1 && !cond2))
foo()