aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Lower
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2024-04-19 15:41:50 -0700
committerVitaly Buka <vitalybuka@google.com>2024-04-19 15:41:50 -0700
commitfb6bcedb3de596c2ddf56fd0001e3a6624b62257 (patch)
tree32fa165efef87810ce2e68da89ad23cfc545d52a /flang/lib/Lower
parent31cb633e504579e57f6e01a4f8187089b87f1e2e (diff)
parentd9169ffaf7c01691644537d3443240748b107359 (diff)
downloadllvm-fb6bcedb3de596c2ddf56fd0001e3a6624b62257.zip
llvm-fb6bcedb3de596c2ddf56fd0001e3a6624b62257.tar.gz
llvm-fb6bcedb3de596c2ddf56fd0001e3a6624b62257.tar.bz2
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'flang/lib/Lower')
-rw-r--r--flang/lib/Lower/Allocatable.cpp12
-rw-r--r--flang/lib/Lower/ConvertVariable.cpp5
-rw-r--r--flang/lib/Lower/OpenMP/ReductionProcessor.cpp4
3 files changed, 12 insertions, 9 deletions
diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp
index 38f6152..8e84ea2 100644
--- a/flang/lib/Lower/Allocatable.cpp
+++ b/flang/lib/Lower/Allocatable.cpp
@@ -859,18 +859,20 @@ genDeallocate(fir::FirOpBuilder &builder,
void Fortran::lower::genDeallocateBox(
Fortran::lower::AbstractConverter &converter,
const fir::MutableBoxValue &box, mlir::Location loc,
- mlir::Value declaredTypeDesc) {
+ const Fortran::semantics::Symbol *sym, mlir::Value declaredTypeDesc) {
const Fortran::lower::SomeExpr *statExpr = nullptr;
const Fortran::lower::SomeExpr *errMsgExpr = nullptr;
ErrorManager errorManager;
errorManager.init(converter, loc, statExpr, errMsgExpr);
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
- genDeallocate(builder, converter, loc, box, errorManager, declaredTypeDesc);
+ genDeallocate(builder, converter, loc, box, errorManager, declaredTypeDesc,
+ sym);
}
void Fortran::lower::genDeallocateIfAllocated(
Fortran::lower::AbstractConverter &converter,
- const fir::MutableBoxValue &box, mlir::Location loc) {
+ const fir::MutableBoxValue &box, mlir::Location loc,
+ const Fortran::semantics::Symbol *sym) {
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
mlir::Value isAllocated =
fir::factory::genIsAllocatedOrAssociatedTest(builder, loc, box);
@@ -880,9 +882,9 @@ void Fortran::lower::genDeallocateIfAllocated(
eleType.isa<fir::RecordType>() && box.isPolymorphic()) {
mlir::Value declaredTypeDesc = builder.create<fir::TypeDescOp>(
loc, mlir::TypeAttr::get(eleType));
- genDeallocateBox(converter, box, loc, declaredTypeDesc);
+ genDeallocateBox(converter, box, loc, sym, declaredTypeDesc);
} else {
- genDeallocateBox(converter, box, loc);
+ genDeallocateBox(converter, box, loc, sym);
}
})
.end();
diff --git a/flang/lib/Lower/ConvertVariable.cpp b/flang/lib/Lower/ConvertVariable.cpp
index 2d2d9eb..c40435c 100644
--- a/flang/lib/Lower/ConvertVariable.cpp
+++ b/flang/lib/Lower/ConvertVariable.cpp
@@ -916,13 +916,14 @@ static void instantiateLocal(Fortran::lower::AbstractConverter &converter,
break;
case VariableCleanUp::Deallocate:
auto *converterPtr = &converter;
- converter.getFctCtx().attachCleanup([converterPtr, loc, exv]() {
+ auto *sym = &var.getSymbol();
+ converter.getFctCtx().attachCleanup([converterPtr, loc, exv, sym]() {
const fir::MutableBoxValue *mutableBox =
exv.getBoxOf<fir::MutableBoxValue>();
assert(mutableBox &&
"trying to deallocate entity not lowered as allocatable");
Fortran::lower::genDeallocateIfAllocated(*converterPtr, *mutableBox,
- loc);
+ loc, sym);
});
}
}
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
index 6a91ee4..9f8352a 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
@@ -220,12 +220,12 @@ mlir::Value ReductionProcessor::createScalarCombiner(
switch (redId) {
case ReductionIdentifier::MAX:
reductionOp =
- getReductionOperation<mlir::arith::MaximumFOp, mlir::arith::MaxSIOp>(
+ getReductionOperation<mlir::arith::MaxNumFOp, mlir::arith::MaxSIOp>(
builder, type, loc, op1, op2);
break;
case ReductionIdentifier::MIN:
reductionOp =
- getReductionOperation<mlir::arith::MinimumFOp, mlir::arith::MinSIOp>(
+ getReductionOperation<mlir::arith::MinNumFOp, mlir::arith::MinSIOp>(
builder, type, loc, op1, op2);
break;
case ReductionIdentifier::IOR: