From 4e02468fee54367e28d0828bcb04a35cd0170cf3 Mon Sep 17 00:00:00 2001 From: erwei-xilinx Date: Mon, 16 Dec 2024 15:41:47 -0800 Subject: [PATCH] Remove redundant code; switch to `OperationEquivalence::isEquivalentTo` (#1981) --- lib/Dialect/AIE/IR/AIEDialect.cpp | 40 +++++-------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/lib/Dialect/AIE/IR/AIEDialect.cpp b/lib/Dialect/AIE/IR/AIEDialect.cpp index 6e23652786..954dc95823 100644 --- a/lib/Dialect/AIE/IR/AIEDialect.cpp +++ b/lib/Dialect/AIE/IR/AIEDialect.cpp @@ -1949,38 +1949,7 @@ static LogicalResult FoldDMAStartOp(DMAStartOp op, PatternRewriter &rewriter) { return failure(); // Check for identical bds. - auto areIdenticalUseLocks = [](UseLockOp op1, UseLockOp op2) { - if (!op1 || !op2) - return false; - if (op1.getLock() != op2.getLock()) - return false; - if (op1.getAction() != op2.getAction()) - return false; - if (op1.getValue() != op2.getValue()) - return false; - return true; - }; - auto areIdenticalDmaBDOps = [](DMABDOp op1, DMABDOp op2) { - if (!op1 || !op2) - return false; - if (op1.getBuffer() != op2.getBuffer()) - return false; - if (op1.getOffset() != op2.getOffset()) - return false; - if (op1.getLen() != op2.getLen()) - return false; - if (op1.getDimensions() != op2.getDimensions()) - return false; - if (op1.getPadDimensions() != op2.getPadDimensions()) - return false; - if (op1.getPadValue() != op2.getPadValue()) - return false; - if (op1.getPacket() != op2.getPacket()) - return false; - return true; - }; - auto areIdenticalBDs = [areIdenticalUseLocks, - areIdenticalDmaBDOps](Block *b1, Block *b2) { + auto areIdenticalBDs = [](Block *b1, Block *b2) { auto b1OpRange = b1->without_terminator(); auto b2OpRange = b2->without_terminator(); if (llvm::range_size(b1OpRange) != llvm::range_size(b2OpRange)) @@ -1993,11 +1962,14 @@ static LogicalResult FoldDMAStartOp(DMAStartOp op, PatternRewriter &rewriter) { if (auto b1UseLockOp = dyn_cast(*b1It)) { auto b2UseLockOp = dyn_cast(*b2It); - if (!areIdenticalUseLocks(b1UseLockOp, b2UseLockOp)) + if (!OperationEquivalence::isEquivalentTo( + b1UseLockOp, b2UseLockOp, + OperationEquivalence::IgnoreLocations)) return false; } else if (auto b1DMABDOp = dyn_cast(*b1It)) { auto b2DMABDOp = dyn_cast(*b2It); - if (!areIdenticalDmaBDOps(b1DMABDOp, b2DMABDOp)) + if (!OperationEquivalence::isEquivalentTo( + b1DMABDOp, b2DMABDOp, OperationEquivalence::IgnoreLocations)) return false; }