diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsCGTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsCGTest.cpp index 6de57c9801f9..66e500c4d210 100644 --- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsCGTest.cpp +++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsCGTest.cpp @@ -458,6 +458,7 @@ TEST_F(OpenACCUtilsCGTest, getPrivatizeOpFromHandle) { TEST_F(OpenACCUtilsCGTest, getPrivatizeOpFromComputeRegionBlockArg) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr gangDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::blockXDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -540,6 +541,7 @@ TEST_F(OpenACCUtilsCGTest, collectPrivateLocalParDimsFromLaunchFallback) { // With no enclosing parallel loops, collectPrivateLocalParDims falls back to // the block-level launch dimensions. OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr gangDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::blockXDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -678,6 +680,7 @@ TEST_F(OpenACCUtilsCGTest, collectPrivateLocalParDimsFromReductionUsers) { TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateGangPrivate) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr gangDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::blockXDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -699,6 +702,7 @@ TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateGangPrivate) { TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateThreadXPrivate) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr vectorDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::threadXDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -721,6 +725,7 @@ TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateThreadXPrivate) { TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateWorkerPrivateConstant) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr workerDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::threadYDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -746,6 +751,7 @@ TEST_F(OpenACCUtilsCGTest, TEST_F(OpenACCUtilsCGTest, isPrivateLocalSharedMemoryCandidateWorkerPrivateDynamicFails) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr workerDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::threadYDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); @@ -777,6 +783,7 @@ TEST_F(OpenACCUtilsCGTest, TEST_F(OpenACCUtilsCGTest, getPrivateLocalSharedMemoryUpperBoundBytes) { OwningOpRef module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); GPUParallelDimsAttr gangDims = GPUParallelDimsAttr::get( &context, {GPUParallelDimAttr::blockXDim(&context)}); auto c1 = arith::ConstantIndexOp::create(b, loc, 1); diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsGPUTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsGPUTest.cpp index 49090f4d657d..e7ee0655d41f 100644 --- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsGPUTest.cpp +++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsGPUTest.cpp @@ -27,9 +27,15 @@ protected: context.loadDialect(); } + void SetUp() override { + module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); + } + MLIRContext context; OpBuilder b; Location loc; + OwningOpRef module; }; //===----------------------------------------------------------------------===// diff --git a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsReductionTest.cpp b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsReductionTest.cpp index 566f905ff24d..690b174b5ba0 100644 --- a/mlir/unittests/Dialect/OpenACC/OpenACCUtilsReductionTest.cpp +++ b/mlir/unittests/Dialect/OpenACC/OpenACCUtilsReductionTest.cpp @@ -32,9 +32,15 @@ protected: complex::ComplexDialect, memref::MemRefDialect>(); } + void SetUp() override { + module = ModuleOp::create(b, loc); + b.setInsertionPointToStart(module->getBody()); + } + MLIRContext context; OpBuilder b; Location loc; + OwningOpRef module; }; //===----------------------------------------------------------------------===//