[flang-commits] [flang] feeee78 - [mlir] Flip dialects to _Prefixed
Jacques Pienaar via flang-commits
flang-commits at lists.llvm.org
Sat Dec 11 14:55:19 PST 2021
Author: Jacques Pienaar
Date: 2021-12-11T14:21:20-08:00
New Revision: feeee78afcf194e4fd3cb4983239677bc61a2433
URL: https://github.com/llvm/llvm-project/commit/feeee78afcf194e4fd3cb4983239677bc61a2433
DIFF: https://github.com/llvm/llvm-project/commit/feeee78afcf194e4fd3cb4983239677bc61a2433.diff
LOG: [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
Added:
Modified:
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
mlir/include/mlir/Dialect/Math/IR/MathBase.td
mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index ce1ff939b4eab..cb9576855d0fb 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -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");
}
diff --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index 045d780f5b3f8..eb75a35723ab6 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -203,18 +203,21 @@ struct AffineIfCondition {
/// 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 @@ struct AffineIfCondition {
}
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,
diff --git a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
index 00eba22289ff0..8cc2446055dd6 100644
--- a/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
+++ b/flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
@@ -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);
}
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
index 216405cd42191..9ff0da03cf045 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
@@ -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));
}
diff --git a/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
index 13b3866254358..30368c00d4805 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
@@ -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());
diff --git a/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td b/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td
index 5c6b9a52cae37..87439da956407 100644
--- a/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td
+++ b/mlir/include/mlir/Dialect/Arithmetic/IR/ArithmeticBase.td
@@ -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:
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
index 90bdf61408958..f4f73a8ddb14d 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
@@ -48,7 +48,7 @@ def LLVM_Dialect : Dialect {
static StringRef getTargetTripleAttrName() { return "llvm.target_triple"; }
}];
- let emitAccessorPrefix = kEmitAccessorPrefix_Both;
+ let emitAccessorPrefix = kEmitAccessorPrefix_Prefixed;
}
//===----------------------------------------------------------------------===//
diff --git a/mlir/include/mlir/Dialect/Math/IR/MathBase.td b/mlir/include/mlir/Dialect/Math/IR/MathBase.td
index 4216b73844f61..b9869d157a61c 100644
--- a/mlir/include/mlir/Dialect/Math/IR/MathBase.td
+++ b/mlir/include/mlir/Dialect/Math/IR/MathBase.td
@@ -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
diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td
index 66b77e96a2ad5..a32cbe1ec5574 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td
+++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td
@@ -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,
diff --git a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
index 315909bf3f46f..23b9df282af03 100644
--- a/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
+++ b/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
@@ -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.
More information about the flang-commits
mailing list