Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions flang/lib/Lower/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1466,8 +1466,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
assert(falseTarget && "missing conditional branch false block");
mlir::Location loc = toLocation();
mlir::Value bcc = builder->createConvert(loc, builder->getI1Type(), cond);
builder->create<mlir::cf::CondBranchOp>(loc, bcc, trueTarget, std::nullopt,
falseTarget, std::nullopt);
builder->create<mlir::cf::CondBranchOp>(loc, bcc, trueTarget,
mlir::ValueRange{}, falseTarget,
mlir::ValueRange{});
}
void genConditionalBranch(mlir::Value cond,
Fortran::lower::pft::Evaluation *trueTarget,
Expand Down Expand Up @@ -2556,8 +2557,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
builder->setInsertionPointToEnd(loopWrapperOp.getBody());
auto loopOp = builder->create<fir::DoConcurrentLoopOp>(
loc, nestLBs, nestUBs, nestSts, /*loopAnnotation=*/nullptr,
/*local_vars=*/std::nullopt,
/*local_syms=*/nullptr, /*reduce_vars=*/std::nullopt,
/*local_vars=*/mlir::ValueRange{},
/*local_syms=*/nullptr, /*reduce_vars=*/mlir::ValueRange{},
/*reduce_byref=*/nullptr, /*reduce_syms=*/nullptr,
/*reduce_attrs=*/nullptr);

Expand Down Expand Up @@ -3810,9 +3811,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
mlir::Block *selectCaseBlock = insertBlock(blockList[0]);
mlir::Block *assumedSizeBlock =
rankStarBlock ? rankStarBlock : defaultBlock;
builder->create<mlir::cf::CondBranchOp>(loc, isAssumedSize,
assumedSizeBlock, std::nullopt,
selectCaseBlock, std::nullopt);
builder->create<mlir::cf::CondBranchOp>(
loc, isAssumedSize, assumedSizeBlock, mlir::ValueRange{},
selectCaseBlock, mlir::ValueRange{});
startBlock(selectCaseBlock);
}
// Create fir.select_case for the other rank cases.
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Lower/ConvertConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ createStringLitOp(fir::FirOpBuilder &builder, mlir::Location loc,
mlir::NamedAttribute sizeAttr(sizeTag, builder.getI64IntegerAttr(len));
llvm::SmallVector<mlir::NamedAttribute> attrs = {dataAttr, sizeAttr};
return builder.create<fir::StringLitOp>(
loc, llvm::ArrayRef<mlir::Type>{type}, std::nullopt, attrs);
loc, llvm::ArrayRef<mlir::Type>{type}, mlir::ValueRange{}, attrs);
}
}

Expand Down
26 changes: 14 additions & 12 deletions flang/lib/Lower/ConvertExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,9 @@ class ScalarExprLowering {
},
[&](const fir::MutableBoxValue &toBox) {
if (toBox.isPointer()) {
Fortran::lower::associateMutableBox(converter, loc, toBox, expr,
/*lbounds=*/std::nullopt,
stmtCtx);
Fortran::lower::associateMutableBox(
converter, loc, toBox, expr,
/*lbounds=*/mlir::ValueRange{}, stmtCtx);
return;
}
// For allocatable components, a deep copy is needed.
Expand Down Expand Up @@ -3604,8 +3604,9 @@ class ArrayExprLowering {
mlir::Value castTo =
builder.createConvert(loc, fir::HeapType::get(seqTy), load);
mlir::Value shapeOp = builder.genShape(loc, shape);
return builder.create<fir::ArrayLoadOp>(
loc, seqTy, castTo, shapeOp, /*slice=*/mlir::Value{}, std::nullopt);
return builder.create<fir::ArrayLoadOp>(loc, seqTy, castTo, shapeOp,
/*slice=*/mlir::Value{},
mlir::ValueRange{});
};
// Custom lowering of the element store to deal with the extra indirection
// to the lazy allocated buffer.
Expand Down Expand Up @@ -4207,7 +4208,7 @@ class ArrayExprLowering {
auto addr =
builder->create<fir::ArrayCoorOp>(loc, eleRefTy, tmp, shape,
/*slice=*/mlir::Value{}, indices,
/*typeParams=*/std::nullopt);
/*typeParams=*/mlir::ValueRange{});
auto load = builder->create<fir::LoadOp>(loc, addr);
return builder->createConvert(loc, i1Ty, load);
};
Expand Down Expand Up @@ -4522,17 +4523,18 @@ class ArrayExprLowering {
fir::isRecordWithAllocatableMember(eleTy))
TODO(loc, "creating an array temp where the element type has "
"allocatable members");
mlir::Value temp = !seqTy.hasDynamicExtents()
? builder.create<fir::AllocMemOp>(loc, type)
: builder.create<fir::AllocMemOp>(
loc, type, ".array.expr", std::nullopt, shape);
mlir::Value temp =
!seqTy.hasDynamicExtents()
? builder.create<fir::AllocMemOp>(loc, type)
: builder.create<fir::AllocMemOp>(loc, type, ".array.expr",
mlir::ValueRange{}, shape);
fir::FirOpBuilder *bldr = &converter.getFirOpBuilder();
stmtCtx.attachCleanup(
[bldr, loc, temp]() { bldr->create<fir::FreeMemOp>(loc, temp); });
mlir::Value shapeOp = genShapeOp(shape);
return builder.create<fir::ArrayLoadOp>(loc, seqTy, temp, shapeOp,
/*slice=*/mlir::Value{},
std::nullopt);
mlir::ValueRange{});
}

static fir::ShapeOp genShapeOp(mlir::Location loc, fir::FirOpBuilder &builder,
Expand Down Expand Up @@ -6483,7 +6485,7 @@ class ArrayExprLowering {
mlir::Value initBuffSz =
builder.createIntegerConstant(loc, idxTy, clInitialBufferSize);
mem = builder.create<fir::AllocMemOp>(
loc, eleTy, /*typeparams=*/std::nullopt, initBuffSz);
loc, eleTy, /*typeparams=*/mlir::ValueRange{}, initBuffSz);
builder.create<fir::StoreOp>(loc, initBuffSz, buffSize);
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Lower/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void Fortran::lower::genFailImageStatement(
mlir::Location loc = converter.getCurrentLocation();
mlir::func::FuncOp callee =
fir::runtime::getRuntimeFunc<mkRTKey(FailImageStatement)>(loc, builder);
builder.create<fir::CallOp>(loc, callee, std::nullopt);
builder.create<fir::CallOp>(loc, callee, mlir::ValueRange{});
genUnreachable(builder, loc);
}

Expand Down Expand Up @@ -199,7 +199,7 @@ void Fortran::lower::genPauseStatement(
mlir::Location loc = converter.getCurrentLocation();
mlir::func::FuncOp callee =
fir::runtime::getRuntimeFunc<mkRTKey(PauseStatement)>(loc, builder);
builder.create<fir::CallOp>(loc, callee, std::nullopt);
builder.create<fir::CallOp>(loc, callee, mlir::ValueRange{});
}

void Fortran::lower::genPointerAssociate(fir::FirOpBuilder &builder,
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Lower/VectorSubscripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class VectorSubscriptBoxBuilder {
TODO(loc, "threading length parameters in field index op");
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
componentPath.emplace_back(builder.create<fir::FieldIndexOp>(
loc, fldTy, componentName, recTy, /*typeParams*/ std::nullopt));
loc, fldTy, componentName, recTy, /*typeParams=*/mlir::ValueRange{}));
return fir::unwrapSequenceType(recTy.getType(componentName));
}

Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Builder/FIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ fir::StringLitOp fir::FirOpBuilder::createStringLitOp(mlir::Location loc,
mlir::NamedAttribute sizeAttr(sizeTag, getI64IntegerAttr(data.size()));
llvm::SmallVector<mlir::NamedAttribute> attrs{dataAttr, sizeAttr};
return create<fir::StringLitOp>(loc, llvm::ArrayRef<mlir::Type>{type},
std::nullopt, attrs);
mlir::ValueRange{}, attrs);
}

mlir::Value fir::FirOpBuilder::genShape(mlir::Location loc,
Expand Down
6 changes: 4 additions & 2 deletions flang/lib/Optimizer/Builder/Runtime/Intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ mlir::Value fir::runtime::genCpuTime(fir::FirOpBuilder &builder,
mlir::Location loc) {
mlir::func::FuncOp func =
fir::runtime::getRuntimeFunc<mkRTKey(CpuTime)>(loc, builder);
return builder.create<fir::CallOp>(loc, func, std::nullopt).getResult(0);
return builder.create<fir::CallOp>(loc, func, mlir::ValueRange{})
.getResult(0);
}

void fir::runtime::genDateAndTime(fir::FirOpBuilder &builder,
Expand Down Expand Up @@ -280,7 +281,8 @@ void fir::runtime::genRename(fir::FirOpBuilder &builder, mlir::Location loc,
mlir::Value fir::runtime::genTime(fir::FirOpBuilder &builder,
mlir::Location loc) {
auto func = fir::runtime::getRuntimeFunc<mkRTKey(time)>(loc, builder);
return builder.create<fir::CallOp>(loc, func, std::nullopt).getResult(0);
return builder.create<fir::CallOp>(loc, func, mlir::ValueRange{})
.getResult(0);
}

/// generate runtime call to transfer intrinsic with no size argument
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Builder/Runtime/Stop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void fir::runtime::genExit(fir::FirOpBuilder &builder, mlir::Location loc,
void fir::runtime::genAbort(fir::FirOpBuilder &builder, mlir::Location loc) {
mlir::func::FuncOp abortFunc =
fir::runtime::getRuntimeFunc<mkRTKey(Abort)>(loc, builder);
builder.create<fir::CallOp>(loc, abortFunc, std::nullopt);
builder.create<fir::CallOp>(loc, abortFunc, mlir::ValueRange{});
}

void fir::runtime::genReportFatalUserError(fir::FirOpBuilder &builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void OrderedAssignmentRewriter::pre(hlfir::ForallMaskOp forallMaskOp) {
mlir::Location loc = forallMaskOp.getLoc();
mlir::Value mask = generateYieldedScalarValue(forallMaskOp.getMaskRegion(),
builder.getI1Type());
auto ifOp = builder.create<fir::IfOp>(loc, std::nullopt, mask, false);
auto ifOp = builder.create<fir::IfOp>(loc, mlir::TypeRange{}, mask, false);
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
constructStack.push_back(ifOp);
}
Expand Down Expand Up @@ -530,7 +530,7 @@ void OrderedAssignmentRewriter::generateMaskIfOp(mlir::Value cdt) {
mlir::Location loc = cdt.getLoc();
cdt = hlfir::loadTrivialScalar(loc, builder, hlfir::Entity{cdt});
cdt = builder.createConvert(loc, builder.getI1Type(), cdt);
auto ifOp = builder.create<fir::IfOp>(cdt.getLoc(), std::nullopt, cdt,
auto ifOp = builder.create<fir::IfOp>(cdt.getLoc(), mlir::TypeRange{}, cdt,
/*withElseRegion=*/false);
constructStack.push_back(ifOp.getOperation());
builder.setInsertionPointToStart(&ifOp.getThenRegion().front());
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Transforms/MemoryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void AllocaReplaceImpl::genIndirectDeallocation(
rewriter.create<fir::ConvertOp>(loc, intPtrTy, ptrVal);
mlir::Value isAllocated = rewriter.create<mlir::arith::CmpIOp>(
loc, mlir::arith::CmpIPredicate::ne, ptrToInt, c0);
auto ifOp = rewriter.create<fir::IfOp>(loc, std::nullopt, isAllocated,
auto ifOp = rewriter.create<fir::IfOp>(loc, mlir::TypeRange{}, isAllocated,
/*withElseRegion=*/false);
rewriter.setInsertionPointToStart(&ifOp.getThenRegion().front());
mlir::Value cast = fir::factory::createConvert(
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ llvm::LogicalResult SelectTypeConv::genTypeLadderStep(
rewriter.setInsertionPointToEnd(thisBlock);
if (destOps.has_value())
rewriter.create<mlir::cf::CondBranchOp>(loc, cmp, dest, destOps.value(),
newBlock, std::nullopt);
newBlock, mlir::ValueRange{});
else
rewriter.create<mlir::cf::CondBranchOp>(loc, cmp, dest, newBlock);
rewriter.setInsertionPointToEnd(newBlock);
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Optimizer/Transforms/SimplifyFIROperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class DoConcurrentConversion
innermostUnorderdLoop = rewriter.create<fir::DoLoopOp>(
doConcurentOp.getLoc(), lb, ub, st,
/*unordred=*/true, /*finalCountValue=*/false,
/*iterArgs=*/std::nullopt, loop.getReduceVars(),
/*iterArgs=*/mlir::ValueRange{}, loop.getReduceVars(),
loop.getReduceAttrsAttr());
ivArgs.push_back(innermostUnorderdLoop.getInductionVar());
rewriter.setInsertionPointToStart(innermostUnorderdLoop.getBody());
Expand Down
6 changes: 3 additions & 3 deletions flang/unittests/Optimizer/FortranVariableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST_F(FortranVariableTest, SimpleScalar) {
mlir::Value addr = builder->create<fir::AllocaOp>(loc, eleType);
auto name = mlir::StringAttr::get(&context, "x");
auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
/*shape=*/mlir::Value{}, /*typeParams=*/std::nullopt,
/*shape=*/mlir::Value{}, /*typeParams=*/mlir::ValueRange{},
/*dummy_scope=*/nullptr, name,
/*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
/*data_attr=*/cuf::DataAttributeAttr{});
Expand Down Expand Up @@ -102,11 +102,11 @@ TEST_F(FortranVariableTest, SimpleArray) {
extents.size(), fir::SequenceType::getUnknownExtent());
mlir::Type seqTy = fir::SequenceType::get(typeShape, eleType);
mlir::Value addr = builder->create<fir::AllocaOp>(
loc, seqTy, /*pinned=*/false, /*typeParams=*/std::nullopt, extents);
loc, seqTy, /*pinned=*/false, /*typeParams=*/mlir::ValueRange{}, extents);
mlir::Value shape = createShape(extents);
auto name = mlir::StringAttr::get(&context, "x");
auto declare = builder->create<fir::DeclareOp>(loc, addr.getType(), addr,
shape, /*typeParams*/ std::nullopt, /*dummy_scope=*/nullptr, name,
shape, /*typeParams=*/mlir::ValueRange{}, /*dummy_scope=*/nullptr, name,
/*fortran_attrs=*/fir::FortranVariableFlagsAttr{},
/*data_attr=*/cuf::DataAttributeAttr{});

Expand Down
Loading