Skip to content

Commit aeed3ec

Browse files
format
1 parent d8a31d1 commit aeed3ec

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3999,7 +3999,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
39993999
addrTy = fir::HeapType::get(addrTy);
40004000
if (std::holds_alternative<Fortran::parser::IntrinsicTypeSpec>(
40014001
typeSpec->u)) {
4002-
mlir::Type refTy = fir::ReferenceType::get(addrTy, selectorIsVolatile());
4002+
mlir::Type refTy =
4003+
fir::ReferenceType::get(addrTy, selectorIsVolatile());
40034004
if (isPointer || isAllocatable)
40044005
refTy = addrTy;
40054006
exactValue = builder->create<fir::BoxAddrOp>(
@@ -4008,7 +4009,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
40084009
typeSpec->declTypeSpec->AsIntrinsic();
40094010
if (isArray) {
40104011
mlir::Value exact = builder->create<fir::ConvertOp>(
4011-
loc, fir::BoxType::get(addrTy, selectorIsVolatile()), fir::getBase(selector));
4012+
loc, fir::BoxType::get(addrTy, selectorIsVolatile()),
4013+
fir::getBase(selector));
40124014
addAssocEntitySymbol(selectorBox->clone(exact));
40134015
} else if (intrinsic->category() ==
40144016
Fortran::common::TypeCategory::Character) {
@@ -4023,7 +4025,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
40234025
} else if (std::holds_alternative<Fortran::parser::DerivedTypeSpec>(
40244026
typeSpec->u)) {
40254027
exactValue = builder->create<fir::ConvertOp>(
4026-
loc, fir::BoxType::get(addrTy, selectorIsVolatile()), fir::getBase(selector));
4028+
loc, fir::BoxType::get(addrTy, selectorIsVolatile()),
4029+
fir::getBase(selector));
40274030
addAssocEntitySymbol(selectorBox->clone(exactValue));
40284031
}
40294032
} else if (std::holds_alternative<Fortran::parser::DerivedTypeSpec>(
@@ -4041,7 +4044,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
40414044
addrTy = fir::PointerType::get(addrTy);
40424045
if (isAllocatable)
40434046
addrTy = fir::HeapType::get(addrTy);
4044-
mlir::Type classTy = fir::ClassType::get(addrTy, selectorIsVolatile());
4047+
mlir::Type classTy =
4048+
fir::ClassType::get(addrTy, selectorIsVolatile());
40454049
if (classTy == baseTy) {
40464050
addAssocEntitySymbol(selector);
40474051
} else {

flang/lib/Optimizer/Dialect/FIROps.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,21 +1536,24 @@ bool fir::ConvertOp::canBeConverted(mlir::Type inType, mlir::Type outType) {
15361536
areRecordsCompatible(inType, outType);
15371537
}
15381538

1539-
// In general, ptrtoint-like conversions are allowed to lose volatility information
1540-
// because they are either:
1539+
// In general, ptrtoint-like conversions are allowed to lose volatility
1540+
// information because they are either:
15411541
//
15421542
// 1. passing an entity to an external function and there's nothing we can do
15431543
// about volatility after that happens, or
1544-
// 2. for code generation, at which point we represent volatility with attributes
1544+
// 2. for code generation, at which point we represent volatility with
1545+
// attributes
15451546
// on the LLVM instructions and intrinsics.
15461547
//
15471548
// For all other cases, volatility ought to match exactly.
1548-
static mlir::LogicalResult verifyVolatility(mlir::Type inType, mlir::Type outType) {
1549+
static mlir::LogicalResult verifyVolatility(mlir::Type inType,
1550+
mlir::Type outType) {
15491551
const bool toLLVMPointer = mlir::isa<mlir::LLVM::LLVMPointerType>(outType);
15501552
const bool toInteger = fir::isa_integer(outType);
15511553

1552-
// When converting references to classes or allocatables into boxes for runtime arguments,
1553-
// we cast away all the volatility information and pass a box<none>. This is allowed.
1554+
// When converting references to classes or allocatables into boxes for
1555+
// runtime arguments, we cast away all the volatility information and pass a
1556+
// box<none>. This is allowed.
15541557
const bool isBoxNoneLike = [&]() {
15551558
if (fir::isBoxNone(outType))
15561559
return true;
@@ -1561,14 +1564,15 @@ static mlir::LogicalResult verifyVolatility(mlir::Type inType, mlir::Type outTyp
15611564
}
15621565
return false;
15631566
}();
1564-
1567+
15651568
const bool isPtrToIntLike = toLLVMPointer || toInteger || isBoxNoneLike;
15661569
if (isPtrToIntLike) {
15671570
return mlir::success();
15681571
}
15691572

15701573
// In all other cases, we need to check for an exact volatility match.
1571-
return mlir::success(fir::isa_volatile_type(inType) == fir::isa_volatile_type(outType));
1574+
return mlir::success(fir::isa_volatile_type(inType) ==
1575+
fir::isa_volatile_type(outType));
15721576
}
15731577

15741578
llvm::LogicalResult fir::ConvertOp::verify() {

flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,11 @@ llvm::LogicalResult SelectTypeConv::genTypeLadderStep(
404404
auto runtimeAttr =
405405
mlir::NamedAttribute(fir::FIROpsDialect::getFirRuntimeAttrName(),
406406
mlir::UnitAttr::get(rewriter.getContext()));
407-
callee = fir::createFuncOp(rewriter.getUnknownLoc(), mod, fctName,
408-
rewriter.getFunctionType({descNoneTy, typeDescTy},
409-
rewriter.getI1Type()),
410-
{runtimeAttr});
407+
callee =
408+
fir::createFuncOp(rewriter.getUnknownLoc(), mod, fctName,
409+
rewriter.getFunctionType({descNoneTy, typeDescTy},
410+
rewriter.getI1Type()),
411+
{runtimeAttr});
411412
}
412413
cmp = rewriter
413414
.create<fir::CallOp>(loc, callee,

0 commit comments

Comments
 (0)