[mlir] Flip dialects to _Prefixed

Following
https://llvm.discourse.group/t/psa-ods-generated-accessors-will-change-to-have-a-get-prefix-update-you-apis/4476
these have been flipped to both for ~4 weeks, flipping to _Prefixed.

Differential Revision: https://reviews.llvm.org/D115585
This commit is contained in:
Jacques Pienaar 2021-12-11 13:27:11 -08:00
parent 08aa40b9e6
commit feeee78afc
10 changed files with 26 additions and 23 deletions

View File

@ -1038,7 +1038,7 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
auto linkage = convertLinkage(global.linkName());
auto isConst = global.constant().hasValue();
auto g = rewriter.create<mlir::LLVM::GlobalOp>(
loc, tyAttr, isConst, linkage, global.sym_name(), initAttr);
loc, tyAttr, isConst, linkage, global.getSymName(), initAttr);
auto &gr = g.getInitializerRegion();
rewriter.inlineRegionBefore(global.region(), gr, gr.end());
if (!gr.empty()) {
@ -1640,14 +1640,14 @@ struct EmboxCommonConversion : public FIROpConversion<OP> {
auto ty = mlir::LLVM::LLVMPointerType::get(
this->lowerTy().convertType(global.getType()));
return rewriter.create<mlir::LLVM::AddressOfOp>(loc, ty,
global.sym_name());
global.getSymName());
}
if (auto global =
module.template lookupSymbol<mlir::LLVM::GlobalOp>(name)) {
// The global may have already been translated to LLVM.
auto ty = mlir::LLVM::LLVMPointerType::get(global.getType());
return rewriter.create<mlir::LLVM::AddressOfOp>(loc, ty,
global.sym_name());
global.getSymName());
}
// The global does not exist in the current translation unit, but may be
// defined elsewhere (e.g., type defined in a module).
@ -2971,7 +2971,7 @@ struct CoordinateOpConversion
if (auto constOp = dyn_cast<mlir::arith::ConstantIntOp>(defop))
return constOp.value();
if (auto llConstOp = dyn_cast<mlir::LLVM::ConstantOp>(defop))
if (auto attr = llConstOp.value().dyn_cast<mlir::IntegerAttr>())
if (auto attr = llConstOp.getValue().dyn_cast<mlir::IntegerAttr>())
return attr.getValue().getSExtValue();
fir::emitFatalError(val.getLoc(), "must be a constant");
}

View File

@ -203,18 +203,21 @@ private:
/// block arguments of a loopOp or forOp are used as dimensions
MaybeAffineExpr toAffineExpr(mlir::Value value) {
if (auto op = value.getDefiningOp<mlir::arith::SubIOp>())
return affineBinaryOp(mlir::AffineExprKind::Add, toAffineExpr(op.lhs()),
affineBinaryOp(mlir::AffineExprKind::Mul,
toAffineExpr(op.rhs()),
toAffineExpr(-1)));
return affineBinaryOp(
mlir::AffineExprKind::Add, toAffineExpr(op.getLhs()),
affineBinaryOp(mlir::AffineExprKind::Mul, toAffineExpr(op.getRhs()),
toAffineExpr(-1)));
if (auto op = value.getDefiningOp<mlir::arith::AddIOp>())
return affineBinaryOp(mlir::AffineExprKind::Add, op.lhs(), op.rhs());
return affineBinaryOp(mlir::AffineExprKind::Add, op.getLhs(),
op.getRhs());
if (auto op = value.getDefiningOp<mlir::arith::MulIOp>())
return affineBinaryOp(mlir::AffineExprKind::Mul, op.lhs(), op.rhs());
return affineBinaryOp(mlir::AffineExprKind::Mul, op.getLhs(),
op.getRhs());
if (auto op = value.getDefiningOp<mlir::arith::RemUIOp>())
return affineBinaryOp(mlir::AffineExprKind::Mod, op.lhs(), op.rhs());
return affineBinaryOp(mlir::AffineExprKind::Mod, op.getLhs(),
op.getRhs());
if (auto op = value.getDefiningOp<mlir::arith::ConstantOp>())
if (auto intConstant = op.value().dyn_cast<IntegerAttr>())
if (auto intConstant = op.getValue().dyn_cast<IntegerAttr>())
return toAffineExpr(intConstant.getInt());
if (auto blockArg = value.dyn_cast<mlir::BlockArgument>()) {
affineArgs.push_back(value);
@ -227,12 +230,12 @@ private:
}
void fromCmpIOp(mlir::arith::CmpIOp cmpOp) {
auto lhsAffine = toAffineExpr(cmpOp.lhs());
auto rhsAffine = toAffineExpr(cmpOp.rhs());
auto lhsAffine = toAffineExpr(cmpOp.getLhs());
auto rhsAffine = toAffineExpr(cmpOp.getRhs());
if (!lhsAffine.hasValue() || !rhsAffine.hasValue())
return;
auto constraintPair = constraint(
cmpOp.predicate(), rhsAffine.getValue() - lhsAffine.getValue());
cmpOp.getPredicate(), rhsAffine.getValue() - lhsAffine.getValue());
if (!constraintPair)
return;
integerSet = mlir::IntegerSet::get(dimCount, symCount,

View File

@ -46,7 +46,7 @@ TEST_F(DoLoopHelperTest, createLoopWithCountTest) {
checkConstantValue(loop.lowerBound(), 0);
EXPECT_TRUE(mlir::isa<arith::SubIOp>(loop.upperBound().getDefiningOp()));
auto subOp = dyn_cast<arith::SubIOp>(loop.upperBound().getDefiningOp());
EXPECT_EQ(c10, subOp.lhs());
EXPECT_EQ(c10, subOp.getLhs());
checkConstantValue(subOp.getRhs(), 1);
checkConstantValue(loop.getStep(), 1);
}

View File

@ -80,7 +80,7 @@ void checkCharCompare2(
builder, loc, mlir::arith::CmpIPredicate::eq, lhs, rhs);
EXPECT_TRUE(mlir::isa<mlir::arith::CmpIOp>(res.getDefiningOp()));
auto cmpOp = mlir::dyn_cast<mlir::arith::CmpIOp>(res.getDefiningOp());
checkCallOp(cmpOp.lhs().getDefiningOp(), fctName, 4, /*addLocArgs=*/false);
checkCallOp(cmpOp.getLhs().getDefiningOp(), fctName, 4, /*addLocArgs=*/false);
auto allocas = res.getParentBlock()->getOps<fir::AllocaOp>();
EXPECT_TRUE(llvm::empty(allocas));
}

View File

@ -58,7 +58,7 @@ void testGenNearest(fir::FirOpBuilder &builder, mlir::Type xType,
mlir::Value select = callOp.getOperands()[1];
EXPECT_TRUE(mlir::isa<mlir::SelectOp>(select.getDefiningOp()));
auto selectOp = mlir::dyn_cast<mlir::SelectOp>(select.getDefiningOp());
mlir::Value cmp = selectOp.condition();
mlir::Value cmp = selectOp.getCondition();
EXPECT_TRUE(mlir::isa<mlir::arith::CmpFOp>(cmp.getDefiningOp()));
auto cmpOp = mlir::dyn_cast<mlir::arith::CmpFOp>(cmp.getDefiningOp());
EXPECT_EQ(s, cmpOp.getLhs());

View File

@ -22,7 +22,7 @@ def Arithmetic_Dialect : Dialect {
}];
let hasConstantMaterializer = 1;
let emitAccessorPrefix = kEmitAccessorPrefix_Both;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
// The predicate indicates the type of the comparison to perform:

View File

@ -48,7 +48,7 @@ def LLVM_Dialect : Dialect {
static StringRef getTargetTripleAttrName() { return "llvm.target_triple"; }
}];
let emitAccessorPrefix = kEmitAccessorPrefix_Both;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
//===----------------------------------------------------------------------===//

View File

@ -15,6 +15,6 @@ def Math_Dialect : Dialect {
The math dialect is intended to hold mathematical operations on integer and
floating type beyond simple arithmetics.
}];
let emitAccessorPrefix = kEmitAccessorPrefix_Both;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
#endif // MATH_BASE

View File

@ -39,7 +39,7 @@ def ShapeDialect : Dialect {
let hasConstantMaterializer = 1;
let hasOperationAttrVerify = 1;
let emitAccessorPrefix = kEmitAccessorPrefix_Both;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
def Shape_ShapeType : DialectType<ShapeDialect,

View File

@ -28,7 +28,7 @@ def StandardOps_Dialect : Dialect {
let cppNamespace = "::mlir";
let dependentDialects = ["arith::ArithmeticDialect"];
let hasConstantMaterializer = 1;
let emitAccessorPrefix = kEmitAccessorPrefix_Both;
let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
// Base class for Standard dialect ops.