[MLIR] Add not icmp canonicalization documentation

See: https://reviews.llvm.org/D101710
This commit is contained in:
William S. Moses 2021-05-04 11:42:10 -04:00
parent 3273f27692
commit cb395b84b0
1 changed files with 3 additions and 1 deletions

View File

@ -3013,12 +3013,14 @@ OpFoldResult XOrOp::fold(ArrayRef<Attribute> operands) {
namespace {
/// Replace a not of a comparison operation, for example: not(cmp eq A, B) =>
/// cmp ne A, B. Note that a logical not is implemented as xor 1, val
/// cmp ne A, B. Note that a logical not is implemented as xor 1, val.
struct NotICmp : public OpRewritePattern<XOrOp> {
using OpRewritePattern<XOrOp>::OpRewritePattern;
LogicalResult matchAndRewrite(XOrOp op,
PatternRewriter &rewriter) const override {
// Commutative ops (such as xor) have the constant appear second, which
// we assume here.
APInt constValue;
if (!matchPattern(op.getOperand(1), m_ConstantInt(&constValue)))