Apply clang-tidy fixes for llvm-qualified-auto to MLIR (NFC)

This commit is contained in:
Mehdi Amini 2022-03-07 10:12:38 +00:00
parent 393c6db7a1
commit cfdf9747bf
3 changed files with 8 additions and 8 deletions

View File

@ -873,7 +873,7 @@ static void populateMap(GenericOp genericOp, ArrayRef<OpOperand *> operands,
// Get the `sourceShape` of the `sourceType`. If the operand is a result of
// `tensor.cast` operation and source of the cast operation has a static
// shape, then assign it to the `sourceShape`.
auto parentOp = src.getDefiningOp();
auto *parentOp = src.getDefiningOp();
ArrayRef<int64_t> sourceShape = sourceType.getShape();
if (parentOp) {
if (auto castOp = dyn_cast<tensor::CastOp>(parentOp)) {

View File

@ -52,7 +52,7 @@ static bool isEmptyInit(OpOperand *op) {
// Helper to detect sampling operation.
static bool isSampling(GenericOp op) {
auto yieldOp = cast<linalg::YieldOp>(op.region().front().getTerminator());
if (auto def = yieldOp.getOperand(0).getDefiningOp()) {
if (auto *def = yieldOp.getOperand(0).getDefiningOp()) {
if (isa<arith::MulFOp>(def) || isa<arith::MulIOp>(def)) {
// Both scalar input arguments used exactly once.
Value s1 = op.getBlock()->getArgument(0);
@ -68,7 +68,7 @@ static bool isSampling(GenericOp op) {
static bool isMulChain(Value val, Value x) {
if (auto arg = val.dyn_cast<BlockArgument>())
return arg != x;
if (auto def = val.getDefiningOp()) {
if (auto *def = val.getDefiningOp()) {
if (isa<arith::MulFOp>(def) || isa<arith::MulIOp>(def))
return isMulChain(def->getOperand(0), x) &&
isMulChain(def->getOperand(1), x);
@ -79,7 +79,7 @@ static bool isMulChain(Value val, Value x) {
// Helper to detect x = x + <multiplications>.
static bool isSumOfMul(GenericOp op) {
auto yieldOp = cast<linalg::YieldOp>(op.region().front().getTerminator());
if (auto def = yieldOp.getOperand(0).getDefiningOp()) {
if (auto *def = yieldOp.getOperand(0).getDefiningOp()) {
if (isa<arith::AddFOp>(def) || isa<arith::AddIOp>(def)) {
Value x = op.getBlock()->getArguments().back();
return (def->getOperand(0) == x && isMulChain(def->getOperand(1), x)) ||
@ -165,8 +165,8 @@ struct FuseSparseMultiplyOverAdd : public OpRewritePattern<GenericOp> {
addArg(mapper, fusedBlock, consBlock.getArgument(1 - other));
addArg(mapper, fusedBlock, prodBlock.getArgument(num - 1));
// Clone bodies of the producer and consumer in new evaluation order.
auto acc = prodBlock.getTerminator()->getOperand(0).getDefiningOp();
auto sampler = consBlock.getTerminator()->getOperand(0).getDefiningOp();
auto *acc = prodBlock.getTerminator()->getOperand(0).getDefiningOp();
auto *sampler = consBlock.getTerminator()->getOperand(0).getDefiningOp();
rewriter.setInsertionPointToStart(fusedBlock);
Value last;
for (auto &op : prodBlock.without_terminator())

View File

@ -403,8 +403,8 @@ struct AllocaScopeHoister : public OpRewritePattern<AllocaScopeOp> {
if (toHoist.empty())
return failure();
rewriter.setInsertionPoint(lastParentWithoutScope);
for (auto op : toHoist) {
auto cloned = rewriter.clone(*op);
for (auto *op : toHoist) {
auto *cloned = rewriter.clone(*op);
rewriter.replaceOp(op, cloned->getResults());
}
return success();