diff options
Diffstat (limited to 'flang/unittests/Optimizer/Builder')
9 files changed, 115 insertions, 115 deletions
diff --git a/flang/unittests/Optimizer/Builder/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/CharacterTest.cpp index d8d2da4..8dca8e2 100644 --- a/flang/unittests/Optimizer/Builder/CharacterTest.cpp +++ b/flang/unittests/Optimizer/Builder/CharacterTest.cpp @@ -26,10 +26,10 @@ public: // Set up a Module with a dummy function operation inside. // Set the insertion point in the function entry block. - moduleOp = builder.create<mlir::ModuleOp>(loc); + moduleOp = mlir::ModuleOp::create(builder, loc); builder.setInsertionPointToStart(moduleOp->getBody()); - mlir::func::FuncOp func = builder.create<mlir::func::FuncOp>( - loc, "func1", builder.getFunctionType({}, {})); + mlir::func::FuncOp func = mlir::func::FuncOp::create( + builder, loc, "func1", builder.getFunctionType({}, {})); auto *entryBlock = func.addEntryBlock(); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp index d5f00c9..668befd 100644 --- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp +++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp @@ -22,10 +22,10 @@ public: // Set up a Module with a dummy function operation inside. // Set the insertion point in the function entry block. - moduleOp = builder.create<mlir::ModuleOp>(loc); + moduleOp = mlir::ModuleOp::create(builder, loc); builder.setInsertionPointToStart(moduleOp->getBody()); - mlir::func::FuncOp func = builder.create<mlir::func::FuncOp>( - loc, "func1", builder.getFunctionType({}, {})); + mlir::func::FuncOp func = mlir::func::FuncOp::create( + builder, loc, "func1", builder.getFunctionType({}, {})); auto *entryBlock = func.addEntryBlock(); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp index e4c21f6b..e3e3647 100644 --- a/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp +++ b/flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp @@ -26,10 +26,10 @@ public: // Set up a Module with a dummy function operation inside. // Set the insertion point in the function entry block. - moduleOp = builder.create<mlir::ModuleOp>(loc); + moduleOp = mlir::ModuleOp::create(builder, loc); builder.setInsertionPointToStart(moduleOp->getBody()); - mlir::func::FuncOp func = builder.create<mlir::func::FuncOp>( - loc, "func1", builder.getFunctionType({}, {})); + mlir::func::FuncOp func = mlir::func::FuncOp::create( + builder, loc, "func1", builder.getFunctionType({}, {})); auto *entryBlock = func.addEntryBlock(); builder.setInsertionPointToStart(entryBlock); @@ -47,8 +47,8 @@ static arith::CmpIOp createCondition(fir::FirOpBuilder &builder) { auto loc = builder.getUnknownLoc(); auto zero1 = builder.createIntegerConstant(loc, builder.getIndexType(), 0); auto zero2 = builder.createIntegerConstant(loc, builder.getIndexType(), 0); - return builder.create<arith::CmpIOp>( - loc, arith::CmpIPredicate::eq, zero1, zero2); + return arith::CmpIOp::create( + builder, loc, arith::CmpIPredicate::eq, zero1, zero2); } static void checkIntegerConstant(mlir::Value value, mlir::Type ty, int64_t v) { @@ -413,7 +413,7 @@ TEST_F(FIRBuilderTest, getExtents) { llvm::SmallVector<mlir::Value> extents = {c10, c100}; fir::SequenceType::Shape shape(2, fir::SequenceType::getUnknownExtent()); auto arrayTy = fir::SequenceType::get(shape, builder.getI64Type()); - mlir::Value array = builder.create<fir::UndefOp>(loc, arrayTy); + mlir::Value array = fir::UndefOp::create(builder, loc, arrayTy); fir::ArrayBoxValue aab(array, extents, {}); fir::ExtendedValue ex(aab); auto readExtents = fir::factory::getExtents(loc, builder, ex); @@ -468,12 +468,12 @@ TEST_F(FIRBuilderTest, getBaseTypeOf) { auto boxTyArray = fir::BoxType::get(arrayType); auto boxTyScalar = fir::BoxType::get(elementType); - auto ptrValArray = builder.create<fir::UndefOp>(loc, ptrTyArray); - auto ptrValScalar = builder.create<fir::UndefOp>(loc, ptrTyScalar); - auto boxRefValArray = builder.create<fir::UndefOp>(loc, boxRefTyArray); - auto boxRefValScalar = builder.create<fir::UndefOp>(loc, boxRefTyScalar); - auto boxValArray = builder.create<fir::UndefOp>(loc, boxTyArray); - auto boxValScalar = builder.create<fir::UndefOp>(loc, boxTyScalar); + auto ptrValArray = fir::UndefOp::create(builder, loc, ptrTyArray); + auto ptrValScalar = fir::UndefOp::create(builder, loc, ptrTyScalar); + auto boxRefValArray = fir::UndefOp::create(builder, loc, boxRefTyArray); + auto boxRefValScalar = fir::UndefOp::create(builder, loc, boxRefTyScalar); + auto boxValArray = fir::UndefOp::create(builder, loc, boxTyArray); + auto boxValScalar = fir::UndefOp::create(builder, loc, boxTyScalar); llvm::SmallVector<fir::ExtendedValue, 4> scalars; scalars.emplace_back(fir::UnboxedValue(ptrValScalar)); @@ -482,7 +482,7 @@ TEST_F(FIRBuilderTest, getBaseTypeOf) { fir::MutableBoxValue(boxRefValScalar, mlir::ValueRange(), {})); llvm::SmallVector<fir::ExtendedValue, 4> arrays; - auto extent = builder.create<fir::UndefOp>(loc, builder.getIndexType()); + auto extent = fir::UndefOp::create(builder, loc, builder.getIndexType()); llvm::SmallVector<mlir::Value> extents( mlir::dyn_cast<fir::SequenceType>(arrayType).getDimension(), extent.getResult()); @@ -537,10 +537,10 @@ TEST_F(FIRBuilderTest, genArithFastMath) { auto loc = builder.getUnknownLoc(); auto realTy = mlir::Float32Type::get(ctx); - auto arg = builder.create<fir::UndefOp>(loc, realTy); + auto arg = fir::UndefOp::create(builder, loc, realTy); // Test that FastMathFlags is 'none' by default. - mlir::Operation *op1 = builder.create<mlir::arith::AddFOp>(loc, arg, arg); + mlir::Operation *op1 = mlir::arith::AddFOp::create(builder, loc, arg, arg); auto op1_fmi = mlir::dyn_cast_or_null<mlir::arith::ArithFastMathInterface>(op1); EXPECT_TRUE(op1_fmi); @@ -558,7 +558,7 @@ TEST_F(FIRBuilderTest, genArithFastMath) { builder_copy.setFastMathFlags(FMF2); // Modifying FastMathFlags for the copy must not affect the original builder. - mlir::Operation *op2 = builder.create<mlir::arith::AddFOp>(loc, arg, arg); + mlir::Operation *op2 = mlir::arith::AddFOp::create(builder, loc, arg, arg); auto op2_fmi = mlir::dyn_cast_or_null<mlir::arith::ArithFastMathInterface>(op2); EXPECT_TRUE(op2_fmi); @@ -567,7 +567,7 @@ TEST_F(FIRBuilderTest, genArithFastMath) { // Modifying FastMathFlags for the original builder must not affect the copy. mlir::Operation *op3 = - builder_copy.create<mlir::arith::AddFOp>(loc, arg, arg); + mlir::arith::AddFOp::create(builder_copy, loc, arg, arg); auto op3_fmi = mlir::dyn_cast_or_null<mlir::arith::ArithFastMathInterface>(op3); EXPECT_TRUE(op3_fmi); @@ -578,7 +578,7 @@ TEST_F(FIRBuilderTest, genArithFastMath) { fir::FirOpBuilder builder_copy2(builder); mlir::Operation *op4 = - builder_copy2.create<mlir::arith::AddFOp>(loc, arg, arg); + mlir::arith::AddFOp::create(builder_copy2, loc, arg, arg); auto op4_fmi = mlir::dyn_cast_or_null<mlir::arith::ArithFastMathInterface>(op4); EXPECT_TRUE(op4_fmi); @@ -592,10 +592,10 @@ TEST_F(FIRBuilderTest, genArithIntegerOverflow) { auto loc = builder.getUnknownLoc(); auto intTy = IntegerType::get(ctx, 32); - auto arg = builder.create<fir::UndefOp>(loc, intTy); + auto arg = fir::UndefOp::create(builder, loc, intTy); // Test that IntegerOverflowFlags is 'none' by default. - mlir::Operation *op1 = builder.create<mlir::arith::AddIOp>(loc, arg, arg); + mlir::Operation *op1 = mlir::arith::AddIOp::create(builder, loc, arg, arg); auto op1_iofi = mlir::dyn_cast_or_null<mlir::arith::ArithIntegerOverflowFlagsInterface>( op1); @@ -613,7 +613,7 @@ TEST_F(FIRBuilderTest, genArithIntegerOverflow) { // Modifying IntegerOverflowFlags for the copy must not affect the original // builder. - mlir::Operation *op2 = builder.create<mlir::arith::AddIOp>(loc, arg, arg); + mlir::Operation *op2 = mlir::arith::AddIOp::create(builder, loc, arg, arg); auto op2_iofi = mlir::dyn_cast_or_null<mlir::arith::ArithIntegerOverflowFlagsInterface>( op2); @@ -624,7 +624,7 @@ TEST_F(FIRBuilderTest, genArithIntegerOverflow) { // Modifying IntegerOverflowFlags for the original builder must not affect the // copy. mlir::Operation *op3 = - builder_copy.create<mlir::arith::AddIOp>(loc, arg, arg); + mlir::arith::AddIOp::create(builder_copy, loc, arg, arg); auto op3_iofi = mlir::dyn_cast_or_null<mlir::arith::ArithIntegerOverflowFlagsInterface>( op3); @@ -636,7 +636,7 @@ TEST_F(FIRBuilderTest, genArithIntegerOverflow) { fir::FirOpBuilder builder_copy2(builder); mlir::Operation *op4 = - builder_copy2.create<mlir::arith::AddIOp>(loc, arg, arg); + mlir::arith::AddIOp::create(builder_copy2, loc, arg, arg); auto op4_iofi = mlir::dyn_cast_or_null<mlir::arith::ArithIntegerOverflowFlagsInterface>( op4); diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp index a078519..df1411a 100644 --- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp +++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp @@ -25,10 +25,10 @@ public: // Set up a Module with a dummy function operation inside. // Set the insertion point in the function entry block. - moduleOp = builder.create<mlir::ModuleOp>(loc); + moduleOp = mlir::ModuleOp::create(builder, loc); builder.setInsertionPointToStart(moduleOp->getBody()); - mlir::func::FuncOp func = builder.create<mlir::func::FuncOp>( - loc, "func1", builder.getFunctionType({}, {})); + mlir::func::FuncOp func = mlir::func::FuncOp::create( + builder, loc, "func1", builder.getFunctionType({}, {})); auto *entryBlock = func.addEntryBlock(); builder.setInsertionPointToStart(entryBlock); @@ -61,7 +61,7 @@ TEST_F(HLFIRToolsTest, testScalarRoundTrip) { mlir::Location loc = getLoc(); mlir::Type f32Type = mlir::Float32Type::get(&context); mlir::Type scalarf32Type = builder.getRefType(f32Type); - mlir::Value scalarf32Addr = builder.create<fir::UndefOp>(loc, scalarf32Type); + mlir::Value scalarf32Addr = fir::UndefOp::create(builder, loc, scalarf32Type); fir::ExtendedValue scalarf32{scalarf32Addr}; hlfir::EntityWithAttributes scalarf32Entity(createDeclare(scalarf32)); auto [scalarf32Result, cleanup] = @@ -85,7 +85,7 @@ TEST_F(HLFIRToolsTest, testArrayRoundTrip) { mlir::Type f32Type = mlir::Float32Type::get(&context); mlir::Type seqf32Type = builder.getVarLenSeqTy(f32Type, 2); mlir::Type arrayf32Type = builder.getRefType(seqf32Type); - mlir::Value arrayf32Addr = builder.create<fir::UndefOp>(loc, arrayf32Type); + mlir::Value arrayf32Addr = fir::UndefOp::create(builder, loc, arrayf32Type); fir::ArrayBoxValue arrayf32{arrayf32Addr, extents, lbounds}; hlfir::EntityWithAttributes arrayf32Entity(createDeclare(arrayf32)); auto [arrayf32Result, cleanup] = @@ -113,7 +113,7 @@ TEST_F(HLFIRToolsTest, testScalarCharRoundTrip) { mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1); mlir::Type scalarCharType = builder.getRefType(charType); mlir::Value scalarCharAddr = - builder.create<fir::UndefOp>(loc, scalarCharType); + fir::UndefOp::create(builder, loc, scalarCharType); fir::CharBoxValue scalarChar{scalarCharAddr, len}; hlfir::EntityWithAttributes scalarCharEntity(createDeclare(scalarChar)); auto [scalarCharResult, cleanup] = @@ -138,7 +138,7 @@ TEST_F(HLFIRToolsTest, testArrayCharRoundTrip) { mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1); mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2); mlir::Type arrayCharType = builder.getRefType(seqCharType); - mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType); + mlir::Value arrayCharAddr = fir::UndefOp::create(builder, loc, arrayCharType); fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds}; hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar)); auto [arrayCharResult, cleanup] = @@ -170,7 +170,7 @@ TEST_F(HLFIRToolsTest, testArrayCharBoxRoundTrip) { mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2); mlir::Type arrayCharBoxType = fir::BoxType::get(seqCharType); mlir::Value arrayCharAddr = - builder.create<fir::UndefOp>(loc, arrayCharBoxType); + fir::UndefOp::create(builder, loc, arrayCharBoxType); llvm::SmallVector<mlir::Value> explicitTypeParams{len}; fir::BoxValue arrayChar{arrayCharAddr, lbounds, explicitTypeParams}; hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar)); diff --git a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp index 315f8c8..cfd2d48 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp +++ b/flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp @@ -33,10 +33,10 @@ void checkCharCompare1( fir::FirOpBuilder &builder, mlir::Type type, llvm::StringRef fctName) { auto loc = builder.getUnknownLoc(); mlir::Type i32Ty = IntegerType::get(builder.getContext(), 32); - mlir::Value lhsBuff = builder.create<fir::UndefOp>(loc, type); - mlir::Value lhsLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value rhsBuff = builder.create<fir::UndefOp>(loc, type); - mlir::Value rhsLen = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value lhsBuff = fir::UndefOp::create(builder, loc, type); + mlir::Value lhsLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value rhsBuff = fir::UndefOp::create(builder, loc, type); + mlir::Value rhsLen = fir::UndefOp::create(builder, loc, i32Ty); mlir::Value res = fir::runtime::genCharCompare(builder, loc, mlir::arith::CmpIPredicate::eq, lhsBuff, lhsLen, rhsBuff, rhsLen); checkCallOpFromResultBox(lhsBuff, fctName, 4, /*addLocArgs=*/false); @@ -72,10 +72,10 @@ void checkCharCompare2( fir::factory::CharacterExprHelper charHelper(builder, loc); mlir::Type i32Ty = IntegerType::get(builder.getContext(), 32); mlir::Type boxCharTy = fir::BoxCharType::get(builder.getContext(), kind); - mlir::Value lhsBuff = builder.create<fir::UndefOp>(loc, boxCharTy); - mlir::Value lhsLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value rhsBuff = builder.create<fir::UndefOp>(loc, boxCharTy); - mlir::Value rhsLen = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value lhsBuff = fir::UndefOp::create(builder, loc, boxCharTy); + mlir::Value lhsLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value rhsBuff = fir::UndefOp::create(builder, loc, boxCharTy); + mlir::Value rhsLen = fir::UndefOp::create(builder, loc, i32Ty); fir::ExtendedValue lhs = charHelper.toExtendedValue(lhsBuff, lhsLen); fir::ExtendedValue rhs = charHelper.toExtendedValue(rhsBuff, rhsLen); mlir::Value res = fir::runtime::genCharCompare( @@ -97,11 +97,11 @@ void checkGenIndex( fir::FirOpBuilder &builder, llvm::StringRef fctName, unsigned kind) { auto loc = builder.getUnknownLoc(); mlir::Type i32Ty = IntegerType::get(builder.getContext(), 32); - mlir::Value stringBase = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value stringLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value substringBase = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value substringLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value back = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value stringBase = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value stringLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value substringBase = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value substringLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value back = fir::UndefOp::create(builder, loc, i32Ty); mlir::Value res = fir::runtime::genIndex(builder, loc, kind, stringBase, stringLen, substringBase, substringLen, back); checkCallOp(res.getDefiningOp(), fctName, 5, /*addLocArgs=*/false); @@ -160,11 +160,11 @@ void checkGenScan( mlir::Type charTy = fir::CharacterType::get(builder.getContext(), kind, 10); mlir::Type boxTy = fir::BoxType::get(charTy); mlir::Type i32Ty = IntegerType::get(builder.getContext(), 32); - mlir::Value stringBase = builder.create<fir::UndefOp>(loc, boxTy); - mlir::Value stringLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value setBase = builder.create<fir::UndefOp>(loc, boxTy); - mlir::Value setLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value back = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value stringBase = fir::UndefOp::create(builder, loc, boxTy); + mlir::Value stringLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value setBase = fir::UndefOp::create(builder, loc, boxTy); + mlir::Value setLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value back = fir::UndefOp::create(builder, loc, i32Ty); mlir::Value res = fir::runtime::genScan( builder, loc, kind, stringBase, stringLen, setBase, setLen, back); checkCallOp(res.getDefiningOp(), fctName, 5, /*addLocArgs=*/false); @@ -194,11 +194,11 @@ void checkGenVerify( mlir::Type charTy = fir::CharacterType::get(builder.getContext(), kind, 10); mlir::Type boxTy = fir::BoxType::get(charTy); mlir::Type i32Ty = IntegerType::get(builder.getContext(), 32); - mlir::Value stringBase = builder.create<fir::UndefOp>(loc, boxTy); - mlir::Value stringLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value setBase = builder.create<fir::UndefOp>(loc, boxTy); - mlir::Value setLen = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value back = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value stringBase = fir::UndefOp::create(builder, loc, boxTy); + mlir::Value stringLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value setBase = fir::UndefOp::create(builder, loc, boxTy); + mlir::Value setLen = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value back = fir::UndefOp::create(builder, loc, i32Ty); mlir::Value res = fir::runtime::genVerify( builder, loc, kind, stringBase, stringLen, setBase, setLen, back); checkCallOp(res.getDefiningOp(), fctName, 5, /*addLocArgs=*/false); diff --git a/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp index 47342da..0e867e98 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp +++ b/flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp @@ -15,7 +15,7 @@ using namespace mlir; void testGenExponent(fir::FirOpBuilder &builder, mlir::Type resultType, mlir::Type xType, llvm::StringRef fctName) { auto loc = builder.getUnknownLoc(); - mlir::Value x = builder.create<fir::UndefOp>(loc, xType); + mlir::Value x = fir::UndefOp::create(builder, loc, xType); mlir::Value exp = fir::runtime::genExponent(builder, loc, resultType, x); checkCallOp(exp.getDefiningOp(), fctName, 1, /*addLocArg=*/false); } @@ -35,7 +35,7 @@ void testGenX(fir::FirOpBuilder &builder, mlir::Type xType, mlir::Value (*genFct)(fir::FirOpBuilder &, Location, mlir::Value), llvm::StringRef fctName) { auto loc = builder.getUnknownLoc(); - mlir::Value x = builder.create<fir::UndefOp>(loc, xType); + mlir::Value x = fir::UndefOp::create(builder, loc, xType); mlir::Value val = genFct(builder, loc, x); checkCallOp(val.getDefiningOp(), fctName, 1, /*addLocArg=*/false); } @@ -52,8 +52,8 @@ TEST_F(RuntimeCallTest, genFractionTest) { void testGenNearest(fir::FirOpBuilder &builder, mlir::Type xType, mlir::Type sType, llvm::StringRef fctName) { auto loc = builder.getUnknownLoc(); - mlir::Value x = builder.create<fir::UndefOp>(loc, xType); - mlir::Value s = builder.create<fir::UndefOp>(loc, sType); + mlir::Value x = fir::UndefOp::create(builder, loc, xType); + mlir::Value s = fir::UndefOp::create(builder, loc, sType); mlir::Value nearest = fir::runtime::genNearest(builder, loc, x, s); checkCallOp(nearest.getDefiningOp(), fctName, 2, /*addLocArg=*/false); } @@ -81,8 +81,8 @@ void testGenXI(fir::FirOpBuilder &builder, mlir::Type xType, mlir::Type iType, fir::FirOpBuilder &, Location, mlir::Value, mlir::Value), llvm::StringRef fctName) { auto loc = builder.getUnknownLoc(); - mlir::Value x = builder.create<fir::UndefOp>(loc, xType); - mlir::Value i = builder.create<fir::UndefOp>(loc, iType); + mlir::Value x = fir::UndefOp::create(builder, loc, xType); + mlir::Value i = fir::UndefOp::create(builder, loc, iType); mlir::Value val = genFct(builder, loc, x, i); checkCallOp(val.getDefiningOp(), fctName, 2, /*addLocArg=*/false); } diff --git a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp index a4006c6..91e2d0b 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp +++ b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp @@ -68,8 +68,8 @@ void testGenMaxVal( mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value undef = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value undef = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); mlir::Value max = fir::runtime::genMaxval(builder, loc, undef, mask); checkCallOp(max.getDefiningOp(), fctName, 3); } @@ -93,8 +93,8 @@ void testGenMinVal( mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value undef = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value undef = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); mlir::Value min = fir::runtime::genMinval(builder, loc, undef, mask); checkCallOp(min.getDefiningOp(), fctName, 3); } @@ -135,9 +135,9 @@ void testGenSum( mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value undef = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value undef = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); mlir::Value sum = fir::runtime::genSum(builder, loc, undef, mask, result); if (fir::isa_complex(eleTy)) checkCallOpFromResultBox(result, fctName, 4); @@ -167,9 +167,9 @@ void testGenProduct( mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value undef = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value undef = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); mlir::Value prod = fir::runtime::genProduct(builder, loc, undef, mask, result); if (fir::isa_complex(eleTy)) @@ -200,10 +200,10 @@ void testGenDotProduct( mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value a = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value b = builder.create<fir::UndefOp>(loc, refSeqTy); + mlir::Value a = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value b = fir::UndefOp::create(builder, loc, refSeqTy); mlir::Value result = - builder.create<fir::UndefOp>(loc, fir::ReferenceType::get(eleTy)); + fir::UndefOp::create(builder, loc, fir::ReferenceType::get(eleTy)); mlir::Value prod = fir::runtime::genDotProduct(builder, loc, a, b, result); if (fir::isa_complex(eleTy)) checkCallOpFromResultBox(result, fctName, 3); @@ -236,9 +236,9 @@ void checkGenMxxloc(fir::FirOpBuilder &builder, mlir::Type eleTy, mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), eleTy); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value a = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value a = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); mlir::Value kind = builder.createIntegerConstant(loc, i32Ty, 1); mlir::Value back = builder.createIntegerConstant(loc, i32Ty, 1); genFct(builder, loc, result, a, mask, kind, back); @@ -308,9 +308,9 @@ void checkGenMxxlocDim(fir::FirOpBuilder &builder, mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value a = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value a = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); mlir::Value kind = builder.createIntegerConstant(loc, i32Ty, 1); mlir::Value dim = builder.createIntegerConstant(loc, i32Ty, 1); mlir::Value back = builder.createIntegerConstant(loc, i32Ty, 1); @@ -337,9 +337,9 @@ void checkGenMxxvalChar(fir::FirOpBuilder &builder, mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value a = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value a = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); genFct(builder, loc, result, a, mask); checkCallOpFromResultBox(result, fctName, nbArgs); } @@ -363,9 +363,9 @@ void checkGen4argsDim(fir::FirOpBuilder &builder, mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty); mlir::Type refSeqTy = fir::ReferenceType::get(seqTy); - mlir::Value a = builder.create<fir::UndefOp>(loc, refSeqTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value mask = builder.create<fir::UndefOp>(loc, seqTy); + mlir::Value a = fir::UndefOp::create(builder, loc, refSeqTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value mask = fir::UndefOp::create(builder, loc, seqTy); mlir::Value dim = builder.createIntegerConstant(loc, i32Ty, 1); genFct(builder, loc, result, a, dim, mask); checkCallOpFromResultBox(result, fctName, nbArgs); diff --git a/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h b/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h index 4ecec92..803ea37 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h +++ b/flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h @@ -24,10 +24,10 @@ public: // Set up a Module with a dummy function operation inside. // Set the insertion point in the function entry block. - moduleOp = builder.create<mlir::ModuleOp>(loc); + moduleOp = mlir::ModuleOp::create(builder, loc); builder.setInsertionPointToStart(moduleOp->getBody()); - mlir::func::FuncOp func = builder.create<mlir::func::FuncOp>( - loc, "runtime_unit_tests_func", builder.getFunctionType({}, {})); + mlir::func::FuncOp func = mlir::func::FuncOp::create(builder, loc, + "runtime_unit_tests_func", builder.getFunctionType({}, {})); auto *entryBlock = func.addEntryBlock(); builder.setInsertionPointToStart(entryBlock); diff --git a/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp index 28266bb..b8e8955 100644 --- a/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp +++ b/flang/unittests/Optimizer/Builder/Runtime/TransformationalTest.cpp @@ -16,12 +16,12 @@ void testGenBesselJn( mlir::Type i32Ty = builder.getIntegerType(32); mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), realTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value n1 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value n2 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value x = builder.create<fir::UndefOp>(loc, realTy); - mlir::Value bn1 = builder.create<fir::UndefOp>(loc, realTy); - mlir::Value bn2 = builder.create<fir::UndefOp>(loc, realTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value n1 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value n2 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value x = fir::UndefOp::create(builder, loc, realTy); + mlir::Value bn1 = fir::UndefOp::create(builder, loc, realTy); + mlir::Value bn2 = fir::UndefOp::create(builder, loc, realTy); fir::runtime::genBesselJn(builder, loc, result, n1, n2, x, bn1, bn2); checkCallOpFromResultBox(result, fctName, 6); } @@ -39,9 +39,9 @@ void testGenBesselJnX0( mlir::Type i32Ty = builder.getIntegerType(32); mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), realTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value n1 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value n2 = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value n1 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value n2 = fir::UndefOp::create(builder, loc, i32Ty); fir::runtime::genBesselJnX0(builder, loc, realTy, result, n1, n2); checkCallOpFromResultBox(result, fctName, 3); } @@ -59,12 +59,12 @@ void testGenBesselYn( mlir::Type i32Ty = builder.getIntegerType(32); mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), realTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value n1 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value n2 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value x = builder.create<fir::UndefOp>(loc, realTy); - mlir::Value bn1 = builder.create<fir::UndefOp>(loc, realTy); - mlir::Value bn2 = builder.create<fir::UndefOp>(loc, realTy); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value n1 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value n2 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value x = fir::UndefOp::create(builder, loc, realTy); + mlir::Value bn1 = fir::UndefOp::create(builder, loc, realTy); + mlir::Value bn2 = fir::UndefOp::create(builder, loc, realTy); fir::runtime::genBesselYn(builder, loc, result, n1, n2, x, bn1, bn2); checkCallOpFromResultBox(result, fctName, 6); } @@ -82,9 +82,9 @@ void testGenBesselYnX0( mlir::Type i32Ty = builder.getIntegerType(32); mlir::Type seqTy = fir::SequenceType::get(fir::SequenceType::Shape(1, 10), realTy); - mlir::Value result = builder.create<fir::UndefOp>(loc, seqTy); - mlir::Value n1 = builder.create<fir::UndefOp>(loc, i32Ty); - mlir::Value n2 = builder.create<fir::UndefOp>(loc, i32Ty); + mlir::Value result = fir::UndefOp::create(builder, loc, seqTy); + mlir::Value n1 = fir::UndefOp::create(builder, loc, i32Ty); + mlir::Value n2 = fir::UndefOp::create(builder, loc, i32Ty); fir::runtime::genBesselYnX0(builder, loc, realTy, result, n1, n2); checkCallOpFromResultBox(result, fctName, 3); } @@ -155,9 +155,9 @@ void testGenMatmul(fir::FirOpBuilder &builder, mlir::Type eleTy1, fir::SequenceType::get(fir::SequenceType::Shape(2, 10), eleTy2); mlir::Type boxTy1 = fir::BoxType::get(seqTy1); mlir::Type boxTy2 = fir::BoxType::get(seqTy2); - mlir::Value result = builder.create<fir::UndefOp>(loc, resultTy); - mlir::Value matrixA = builder.create<fir::UndefOp>(loc, boxTy1); - mlir::Value matrixB = builder.create<fir::UndefOp>(loc, boxTy2); + mlir::Value result = fir::UndefOp::create(builder, loc, resultTy); + mlir::Value matrixA = fir::UndefOp::create(builder, loc, boxTy1); + mlir::Value matrixB = fir::UndefOp::create(builder, loc, boxTy2); fir::runtime::genMatmul(builder, loc, result, matrixA, matrixB); checkCallOpFromResultBox(result, funcName, 3); } |