[Mlir-commits] [mlir] dfaadf6 - Update more `parseSourceString()` call sites.

Christian Sigg llvmlistbot at llvm.org
Tue Mar 8 04:26:03 PST 2022


Author: Christian Sigg
Date: 2022-03-08T13:25:54+01:00
New Revision: dfaadf6b12b8ca5e45855dc417e56dc31ff2b2ae

URL: https://github.com/llvm/llvm-project/commit/dfaadf6b12b8ca5e45855dc417e56dc31ff2b2ae
DIFF: https://github.com/llvm/llvm-project/commit/dfaadf6b12b8ca5e45855dc417e56dc31ff2b2ae.diff

LOG: Update more `parseSourceString()` call sites.

Change to non-deprecated function template (see D121075).

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D121102

Added: 
    

Modified: 
    mlir/lib/CAPI/IR/IR.cpp
    mlir/unittests/ExecutionEngine/Invoke.cpp
    mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp
    mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp
    mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
    mlir/unittests/Transforms/Canonicalizer.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index 8efbbebdf9cc8..75ac93ffb6897 100644
--- a/mlir/lib/CAPI/IR/IR.cpp
+++ b/mlir/lib/CAPI/IR/IR.cpp
@@ -195,7 +195,7 @@ MlirModule mlirModuleCreateEmpty(MlirLocation location) {
 
 MlirModule mlirModuleCreateParse(MlirContext context, MlirStringRef module) {
   OwningOpRef<ModuleOp> owning =
-      parseSourceString(unwrap(module), unwrap(context));
+      parseSourceString<ModuleOp>(unwrap(module), unwrap(context));
   if (!owning)
     return MlirModule{nullptr};
   return MlirModule{owning.release().getOperation()};

diff  --git a/mlir/unittests/ExecutionEngine/Invoke.cpp b/mlir/unittests/ExecutionEngine/Invoke.cpp
index 5fbe5818925b8..b38e05c854aae 100644
--- a/mlir/unittests/ExecutionEngine/Invoke.cpp
+++ b/mlir/unittests/ExecutionEngine/Invoke.cpp
@@ -63,7 +63,8 @@ TEST(MLIRExecutionEngine, AddInteger) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  OwningOpRef<ModuleOp> module = parseSourceString(moduleStr, &context);
+  OwningOpRef<ModuleOp> module =
+      parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);
@@ -88,7 +89,8 @@ TEST(MLIRExecutionEngine, SubtractFloat) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  OwningOpRef<ModuleOp> module = parseSourceString(moduleStr, &context);
+  OwningOpRef<ModuleOp> module =
+      parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);
@@ -118,7 +120,7 @@ TEST(NativeMemRefJit, ZeroRankMemref) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  auto module = parseSourceString(moduleStr, &context);
+  auto module = parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);
@@ -153,7 +155,7 @@ TEST(NativeMemRefJit, RankOneMemref) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  auto module = parseSourceString(moduleStr, &context);
+  auto module = parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);
@@ -207,7 +209,8 @@ TEST(NativeMemRefJit, BasicMemref) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  OwningOpRef<ModuleOp> module = parseSourceString(moduleStr, &context);
+  OwningOpRef<ModuleOp> module =
+      parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);
@@ -249,7 +252,7 @@ TEST(NativeMemRefJit, JITCallback) {
   registerAllDialects(registry);
   registerLLVMDialectTranslation(registry);
   MLIRContext context(registry);
-  auto module = parseSourceString(moduleStr, &context);
+  auto module = parseSourceString<ModuleOp>(moduleStr, &context);
   ASSERT_TRUE(!!module);
   ASSERT_TRUE(succeeded(lowerToLLVMDialect(*module)));
   auto jitOrError = ExecutionEngine::create(*module);

diff  --git a/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp b/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp
index 02bf4551d933c..4f473161f3c8b 100644
--- a/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp
+++ b/mlir/unittests/Interfaces/ControlFlowInterfacesTest.cpp
@@ -82,7 +82,7 @@ TEST(RegionBranchOpInterface, MutuallyExclusiveOps) {
   registry.insert<CFTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   Operation *testOp = &module->getBody()->getOperations().front();
   Operation *op1 = &testOp->getRegion(0).front().front();
   Operation *op2 = &testOp->getRegion(1).front().front();
@@ -103,7 +103,7 @@ TEST(RegionBranchOpInterface, NotMutuallyExclusiveOps) {
   registry.insert<CFTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   Operation *testOp = &module->getBody()->getOperations().front();
   Operation *op1 = &testOp->getRegion(0).front().front();
   Operation *op2 = &testOp->getRegion(1).front().front();
@@ -130,7 +130,7 @@ TEST(RegionBranchOpInterface, NestedMutuallyExclusiveOps) {
   registry.insert<CFTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   Operation *testOp = &module->getBody()->getOperations().front();
   Operation *op1 =
       &testOp->getRegion(0).front().front().getRegion(0).front().front();

diff  --git a/mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp b/mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp
index f6b52b929dbab..bfe21a45e39a1 100644
--- a/mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp
+++ b/mlir/unittests/Interfaces/DataLayoutInterfacesTest.cpp
@@ -236,7 +236,7 @@ module {}
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   DataLayout layout(module.get());
   EXPECT_EQ(layout.getTypeSize(IntegerType::get(&ctx, 42)), 6u);
   EXPECT_EQ(layout.getTypeSize(Float16Type::get(&ctx)), 2u);
@@ -257,7 +257,7 @@ TEST(DataLayout, NullSpec) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -280,7 +280,7 @@ TEST(DataLayout, EmptySpec) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -306,7 +306,7 @@ TEST(DataLayout, SpecWithEntries) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -338,7 +338,7 @@ TEST(DataLayout, Caching) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -369,7 +369,7 @@ TEST(DataLayout, CacheInvalidation) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -395,7 +395,7 @@ TEST(DataLayout, UnimplementedTypeInterface) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);
@@ -414,7 +414,7 @@ TEST(DataLayout, SevenBitByte) {
   registry.insert<DLTIDialect, DLTestDialect>();
   MLIRContext ctx(registry);
 
-  OwningOpRef<ModuleOp> module = parseSourceString(ir, &ctx);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(ir, &ctx);
   auto op =
       cast<DataLayoutOpInterface>(module->getBody()->getOperations().front());
   DataLayout layout(op);

diff  --git a/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp b/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
index 7811fb0a546db..6f84273d81d30 100644
--- a/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
+++ b/mlir/unittests/Interfaces/InferTypeOpInterfaceTest.cpp
@@ -35,7 +35,7 @@ class ValueShapeRangeTest : public testing::Test {
 
     registry.insert<func::FuncDialect, arith::ArithmeticDialect>();
     ctx.appendDialectRegistry(registry);
-    module = parseSourceString(ir, &ctx);
+    module = parseSourceString<ModuleOp>(ir, &ctx);
     mapFn = cast<FuncOp>(module->front());
   }
 

diff  --git a/mlir/unittests/Transforms/Canonicalizer.cpp b/mlir/unittests/Transforms/Canonicalizer.cpp
index 0d465fc72a87b..d643237780311 100644
--- a/mlir/unittests/Transforms/Canonicalizer.cpp
+++ b/mlir/unittests/Transforms/Canonicalizer.cpp
@@ -74,7 +74,7 @@ TEST(CanonicalizerTest, TestDisablePatterns) {
     %1 = "test.foo"() {sym_name = "B"} : () -> (f32)
   )mlir";
 
-  OwningOpRef<ModuleOp> module = mlir::parseSourceString(code, &context);
+  OwningOpRef<ModuleOp> module = parseSourceString<ModuleOp>(code, &context);
   ASSERT_TRUE(succeeded(mgr.run(*module)));
 
   EXPECT_TRUE(module->lookupSymbol("B"));


        


More information about the Mlir-commits mailing list