Skip to content

Commit 037f2a2

Browse files
committed
Merge branch 'main' into load-nd-with-offsets-2
2 parents 30ff640 + 0b6df54 commit 037f2a2

File tree

65 files changed

+1285
-709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1285
-709
lines changed

.github/new-prs-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ mlgo:
718718
- llvm/lib/Analysis/models/**
719719
- llvm/test/Analysis/IR2Vec/**
720720
- llvm/tools/llvm-ir2vec/**
721+
- llvm/docs/CommandGuide/llvm-ir2vec.rst
721722

722723
tools:llvm-exegesis:
723724
- llvm/tools/llvm-exegesis/**

clang/docs/SanitizerSpecialCaseList.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Example
3939
void bad_foo() {
4040
int *a = (int*)malloc(40);
4141
a[10] = 1;
42+
free(a);
4243
}
4344
int main() { bad_foo(); }
4445
$ cat ignorelist.txt

clang/lib/AST/StmtPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) {
610610
}
611611
}
612612

613-
if (auto *FS = static_cast<ObjCAtFinallyStmt *>(Node->getFinallyStmt())) {
613+
if (ObjCAtFinallyStmt *FS = Node->getFinallyStmt()) {
614614
Indent() << "@finally";
615615
if (auto *CS = dyn_cast<CompoundStmt>(FS->getFinallyBody())) {
616616
PrintRawCompoundStmt(CS);

clang/lib/CodeGen/CodeGenFunction.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ void CodeGenFunction::CGFPOptionsRAII::ConstructorHelper(FPOptions FPFeatures) {
161161
llvm::RoundingMode NewRoundingBehavior = FPFeatures.getRoundingMode();
162162
CGF.Builder.setDefaultConstrainedRounding(NewRoundingBehavior);
163163
auto NewExceptionBehavior =
164-
ToConstrainedExceptMD(static_cast<LangOptions::FPExceptionModeKind>(
165-
FPFeatures.getExceptionMode()));
164+
ToConstrainedExceptMD(FPFeatures.getExceptionMode());
166165
CGF.Builder.setDefaultConstrainedExcept(NewExceptionBehavior);
167166

168167
CGF.SetFastMathFlags(FPFeatures);

clang/lib/Sema/SemaInit.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,7 +3572,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
35723572
Designators.push_back(ASTDesignator::CreateFieldDesignator(
35733573
D.getFieldDecl(), D.getDotLoc(), D.getFieldLoc()));
35743574
} else if (D.isArrayDesignator()) {
3575-
Expr *Index = static_cast<Expr *>(D.getArrayIndex());
3575+
Expr *Index = D.getArrayIndex();
35763576
llvm::APSInt IndexValue;
35773577
if (!Index->isTypeDependent() && !Index->isValueDependent())
35783578
Index = CheckArrayDesignatorExpr(*this, Index, IndexValue).get();
@@ -3584,8 +3584,8 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig,
35843584
InitExpressions.push_back(Index);
35853585
}
35863586
} else if (D.isArrayRangeDesignator()) {
3587-
Expr *StartIndex = static_cast<Expr *>(D.getArrayRangeStart());
3588-
Expr *EndIndex = static_cast<Expr *>(D.getArrayRangeEnd());
3587+
Expr *StartIndex = D.getArrayRangeStart();
3588+
Expr *EndIndex = D.getArrayRangeEnd();
35893589
llvm::APSInt StartValue;
35903590
llvm::APSInt EndValue;
35913591
bool StartDependent = StartIndex->isTypeDependent() ||

flang/lib/Lower/Bridge.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,11 @@ class FirConverter : public Fortran::lower::AbstractConverter {
810810
fir::ExtendedValue read = fir::factory::genMutableBoxRead(
811811
*builder, loc, box, /*mayBePolymorphic=*/false);
812812
if (auto read_arr_box = read.getBoxOf<fir::ArrayBoxValue>()) {
813-
fir::factory::genInlinedAllocation(
814-
*builder, loc, *new_box, read_arr_box->getLBounds(),
815-
read_arr_box->getExtents(),
816-
/*lenParams=*/std::nullopt, name,
817-
/*mustBeHeap=*/true);
813+
fir::factory::genInlinedAllocation(*builder, loc, *new_box,
814+
read_arr_box->getLBounds(),
815+
read_arr_box->getExtents(),
816+
/*lenParams=*/{}, name,
817+
/*mustBeHeap=*/true);
818818
} else if (auto read_char_arr_box =
819819
read.getBoxOf<fir::CharArrayBoxValue>()) {
820820
fir::factory::genInlinedAllocation(
@@ -825,8 +825,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
825825
} else if (auto read_char_box =
826826
read.getBoxOf<fir::CharBoxValue>()) {
827827
fir::factory::genInlinedAllocation(*builder, loc, *new_box,
828-
/*lbounds=*/std::nullopt,
829-
/*extents=*/std::nullopt,
828+
/*lbounds=*/{},
829+
/*extents=*/{},
830830
read_char_box->getLen(), name,
831831
/*mustBeHeap=*/true);
832832
} else {
@@ -4590,8 +4590,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
45904590
// the static type of the LHS.
45914591
if (Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>(
45924592
assign.rhs))
4593-
return fir::factory::createUnallocatedBox(*builder, loc, lhsBoxType,
4594-
std::nullopt);
4593+
return fir::factory::createUnallocatedBox(*builder, loc, lhsBoxType, {});
45954594
hlfir::Entity rhs = Fortran::lower::convertExprToHLFIR(
45964595
loc, *this, assign.rhs, localSymbols, rhsContext);
45974596
// Create pointer descriptor value from the RHS.
@@ -5199,7 +5198,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
51995198
"LEN parameters");
52005199
lhsRealloc = fir::factory::genReallocIfNeeded(
52015200
*builder, loc, *lhsMutableBox,
5202-
/*shape=*/std::nullopt, lengthParams);
5201+
/*shape=*/{}, lengthParams);
52035202
return lhsRealloc->newValue;
52045203
}
52055204
return genExprAddr(assign.lhs, stmtCtx);
@@ -5271,7 +5270,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
52715270
if (lhsIsWholeAllocatable) {
52725271
assert(lhsRealloc.has_value());
52735272
fir::factory::finalizeRealloc(*builder, loc, *lhsMutableBox,
5274-
/*lbounds=*/std::nullopt,
5273+
/*lbounds=*/{},
52755274
/*takeLboundsIfRealloc=*/false,
52765275
*lhsRealloc);
52775276
}
@@ -6059,8 +6058,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
60596058
mlir::func::FuncOp func = fir::FirOpBuilder::createFunction(
60606059
mlir::UnknownLoc::get(context), getModuleOp(),
60616060
fir::NameUniquer::doGenerated("Sham"),
6062-
mlir::FunctionType::get(context, std::nullopt, std::nullopt),
6063-
symbolTable);
6061+
mlir::FunctionType::get(context, {}, {}), symbolTable);
60646062
func.addEntryBlock();
60656063
CHECK(!builder && "Expected builder to be uninitialized");
60666064
builder = new fir::FirOpBuilder(func, bridge.getKindMap(), symbolTable);

flang/lib/Lower/ConvertCall.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,7 @@ Fortran::lower::genCallOpAndResult(
496496
auto *context = builder.getContext();
497497
if (mlir::isa<fir::BoxProcType>(snd) &&
498498
mlir::isa<mlir::FunctionType>(fst.getType())) {
499-
auto funcTy =
500-
mlir::FunctionType::get(context, std::nullopt, std::nullopt);
499+
auto funcTy = mlir::FunctionType::get(context, {}, {});
501500
auto boxProcTy = builder.getBoxProcType(funcTy);
502501
if (mlir::Value host = argumentHostAssocs(converter, fst)) {
503502
cast = builder.create<fir::EmboxProcOp>(
@@ -1714,7 +1713,7 @@ void prepareUserCallArguments(
17141713
/*nonDeferredParams=*/mlir::ValueRange{},
17151714
/*mutableProperties=*/{});
17161715
fir::factory::associateMutableBox(builder, loc, ptrBox, actualExv,
1717-
/*lbounds=*/std::nullopt);
1716+
/*lbounds=*/{});
17181717
caller.placeInput(arg, irBox);
17191718
continue;
17201719
}

flang/lib/Lower/ConvertConstant.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ static mlir::Value genStructureComponentInit(
374374
"allocatable component value that is not NULL");
375375
} else {
376376
// Handle NULL() initialization
377-
mlir::Value componentValue{fir::factory::createUnallocatedBox(
378-
builder, loc, componentTy, std::nullopt)};
377+
mlir::Value componentValue{
378+
fir::factory::createUnallocatedBox(builder, loc, componentTy, {})};
379379
componentValue = builder.createConvert(loc, componentTy, componentValue);
380380

381381
return builder.create<fir::InsertValueOp>(

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ absentBoxToUnallocatedBox(fir::FirOpBuilder &builder, mlir::Location loc,
596596
mlir::Type boxType = box.getType();
597597
assert(mlir::isa<fir::BoxType>(boxType) && "argument must be a fir.box");
598598
mlir::Value emptyBox =
599-
fir::factory::createUnallocatedBox(builder, loc, boxType, std::nullopt);
599+
fir::factory::createUnallocatedBox(builder, loc, boxType, {});
600600
auto safeToReadBox =
601601
builder.create<mlir::arith::SelectOp>(loc, isPresent, box, emptyBox);
602602
return fir::substBase(exv, safeToReadBox);
@@ -2663,8 +2663,7 @@ class ScalarExprLowering {
26632663
/*nonDeferredParams=*/mlir::ValueRange{},
26642664
/*mutableProperties=*/{});
26652665
Fortran::lower::associateMutableBox(converter, loc, pointer, *expr,
2666-
/*lbounds=*/std::nullopt,
2667-
stmtCtx);
2666+
/*lbounds=*/{}, stmtCtx);
26682667
caller.placeInput(arg, irBox);
26692668
continue;
26702669
}
@@ -6186,7 +6185,7 @@ class ArrayExprLowering {
61866185
mlir::FunctionType memcpyType() {
61876186
auto ptrTy = mlir::LLVM::LLVMPointerType::get(builder.getContext());
61886187
llvm::SmallVector<mlir::Type> args = {ptrTy, ptrTy, builder.getI64Type()};
6189-
return mlir::FunctionType::get(builder.getContext(), args, std::nullopt);
6188+
return mlir::FunctionType::get(builder.getContext(), args, {});
61906189
}
61916190

61926191
/// Create a call to the LLVM memcpy intrinsic.

flang/lib/Lower/ConvertExprToHLFIR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ class HlfirBuilder {
19451945
fir::emitFatalError(loc, "pointer component designator could not be "
19461946
"lowered to mutable box");
19471947
Fortran::lower::associateMutableBox(converter, loc, *toBox, expr,
1948-
/*lbounds=*/std::nullopt, stmtCtx);
1948+
/*lbounds=*/{}, stmtCtx);
19491949
continue;
19501950
}
19511951

0 commit comments

Comments
 (0)