Index: flang/lib/Lower/CharacterExpr.cpp =================================================================== --- flang/lib/Lower/CharacterExpr.cpp +++ flang/lib/Lower/CharacterExpr.cpp @@ -352,8 +352,7 @@ auto blank = createBlankConstantCode(getCharacterType(str)); mlir::Value lastChar = builder.create(loc, len, one); - auto iterWhile = builder.create( - loc, lastChar, zero, minusOne, trueVal, lastChar); + fir::IterWhileOp iterWhile; auto insPt = builder.saveInsertionPoint(); builder.setInsertionPointToStart(iterWhile.getBody()); auto index = iterWhile.getInductionVar(); Index: flang/lib/Lower/ComplexExpr.cpp =================================================================== --- flang/lib/Lower/ComplexExpr.cpp +++ flang/lib/Lower/ComplexExpr.cpp @@ -15,8 +15,7 @@ mlir::Type Fortran::lower::ComplexExprHelper::getComplexPartType(mlir::Type complexType) { - return Fortran::lower::convertReal( - builder.getContext(), complexType.cast().getFKind()); + return {}; } mlir::Type @@ -27,9 +26,7 @@ mlir::Value Fortran::lower::ComplexExprHelper::createComplex(fir::KindTy kind, mlir::Value real, mlir::Value imag) { - auto complexTy = fir::CplxType::get(builder.getContext(), kind); - mlir::Value und = builder.create(loc, complexTy); - return insert(insert(und, real), imag); + return {}; } mlir::Value Fortran::lower::ComplexExprHelper::createComplex(mlir::Type cplxTy, Index: flang/lib/Lower/ConvertType.cpp =================================================================== --- flang/lib/Lower/ConvertType.cpp +++ flang/lib/Lower/ConvertType.cpp @@ -155,9 +155,6 @@ mlir::Type genFIRType(mlir::MLIRContext *context, int KIND) { - if (Fortran::evaluate::IsValidKindOfIntrinsicType( - Fortran::common::TypeCategory::Character, KIND)) - return fir::CharacterType::get(context, KIND); return {}; } @@ -165,9 +162,6 @@ mlir::Type genFIRType(mlir::MLIRContext *context, int KIND) { - if (Fortran::evaluate::IsValidKindOfIntrinsicType( - Fortran::common::TypeCategory::Complex, KIND)) - return fir::CplxType::get(context, KIND); return {}; } Index: flang/lib/Lower/DoLoopHelper.cpp =================================================================== --- flang/lib/Lower/DoLoopHelper.cpp +++ flang/lib/Lower/DoLoopHelper.cpp @@ -15,16 +15,6 @@ void Fortran::lower::DoLoopHelper::createLoop( mlir::Value lb, mlir::Value ub, mlir::Value step, const BodyGenerator &bodyGenerator) { - auto lbi = builder.convertToIndexType(loc, lb); - auto ubi = builder.convertToIndexType(loc, ub); - assert(step && "step must be an actual Value"); - auto inc = builder.convertToIndexType(loc, step); - auto loop = builder.create(loc, lbi, ubi, inc); - auto insertPt = builder.saveInsertionPoint(); - builder.setInsertionPointToStart(loop.getBody()); - auto index = loop.getInductionVar(); - bodyGenerator(builder, index); - builder.restoreInsertionPoint(insertPt); } void Fortran::lower::DoLoopHelper::createLoop( Index: flang/lib/Lower/FIRBuilder.cpp =================================================================== --- flang/lib/Lower/FIRBuilder.cpp +++ flang/lib/Lower/FIRBuilder.cpp @@ -146,12 +146,6 @@ if ((fir::isa_real(fromTy) || fromTy.isSignlessInteger()) && fir::isa_complex(toTy)) { // imaginary part is zero - auto eleTy = helper.getComplexPartType(toTy); - auto cast = createConvert(loc, eleTy, val); - llvm::APFloat zero{ - kindMap.getFloatSemantics(toTy.cast().getFKind()), 0}; - auto imag = createRealConstant(loc, eleTy, zero); - return helper.createComplex(toTy, cast, imag); } // FIXME: add a fir::is_integer() test if (fir::isa_complex(fromTy) && Index: flang/lib/Lower/IO.cpp =================================================================== --- flang/lib/Lower/IO.cpp +++ flang/lib/Lower/IO.cpp @@ -176,13 +176,6 @@ // A previous I/O call for a statement returned the bool `ok`. If this call // is in a fir.iterate_while loop, the result must be propagated up to the // loop scope. That is done in genIoLoop, but it is enabled here. - auto whereOp = - inIterWhileLoop - ? builder.create(loc, builder.getI1Type(), ok, true) - : builder.create(loc, ok, /*withOtherwise=*/false); - if (!insertPt.isSet()) - insertPt = builder.saveInsertionPoint(); - builder.setInsertionPointToStart(&whereOp.whereRegion().front()); } template @@ -202,10 +195,6 @@ return ty.getWidth() <= 32 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); - if (auto ty = type.dyn_cast()) - return ty.getFKind() <= 4 - ? getIORuntimeFunc(loc, builder) - : getIORuntimeFunc(loc, builder); if (type.isa()) return getIORuntimeFunc(loc, builder); if (type.isa()) @@ -274,10 +263,6 @@ return ty.getWidth() <= 32 ? getIORuntimeFunc(loc, builder) : getIORuntimeFunc(loc, builder); - if (auto ty = type.dyn_cast()) - return ty.getFKind() <= 4 - ? getIORuntimeFunc(loc, builder) - : getIORuntimeFunc(loc, builder); if (type.isa()) return getIORuntimeFunc(loc, builder); if (type.isa()) @@ -314,10 +299,6 @@ auto argType = inputFunc.getType().getInput(1); auto originalItemAddr = itemAddr; mlir::Type complexPartType; - if (itemType.isa()) - complexPartType = builder.getRefType( - Fortran::lower::ComplexExprHelper{builder, loc}.getComplexPartType( - itemType)); auto complexPartAddr = [&](int index) { return builder.create( loc, complexPartType, originalItemAddr, @@ -386,15 +367,6 @@ }; if (!checkResult) { // No I/O call result checks - the loop is a fir.do_loop op. - auto loopOp = - builder.create(loc, lowerValue, upperValue, stepValue); - builder.setInsertionPointToStart(loopOp.getBody()); - auto lcv = builder.createConvert(loc, converter.genType(loopSym), - loopOp.getInductionVar()); - builder.create(loc, lcv, loopVar); - insertPt = builder.saveInsertionPoint(); - genItemList(ioImpliedDo, false); - builder.restoreInsertionPoint(parentInsertPt); return; } // Check I/O call results - the loop is a fir.iterate_while op. @@ -411,15 +383,6 @@ auto falseValue = builder.createIntegerConstant(loc, builder.getI1Type(), 0); genItemList(ioImpliedDo, true); // Unwind nested I/O call scopes, filling in true and false ResultOp's. - for (auto *op = builder.getBlock()->getParentOp(); isa(op); - op = op->getBlock()->getParentOp()) { - auto whereOp = dyn_cast(op); - auto *lastOp = &whereOp.whereRegion().front().back(); - builder.setInsertionPointAfter(lastOp); - builder.create(loc, lastOp->getResult(0)); // runtime result - builder.setInsertionPointToStart(&whereOp.otherRegion().front()); - builder.create(loc, falseValue); // known false result - } builder.restoreInsertionPoint(insertPt); builder.create(loc, builder.getBlock()->back().getResult(0)); ok = iterWhileOp.getResult(0); @@ -489,8 +452,7 @@ text = text.drop_front(text.find('(')); text = text.take_front(text.rfind(')') + 1); auto &builder = converter.getFirOpBuilder(); - auto lit = builder.createStringLit( - loc, /*FIXME*/ fir::CharacterType::get(builder.getContext(), 1), text); + mlir::Value lit; auto data = Fortran::lower::CharacterExprHelper{builder, loc}.materializeCharacter( lit); Index: flang/lib/Lower/IntrinsicCall.cpp =================================================================== --- flang/lib/Lower/IntrinsicCall.cpp +++ flang/lib/Lower/IntrinsicCall.cpp @@ -439,8 +439,6 @@ // - or use evaluate/type.h if (auto r{t.dyn_cast()}) return r.getFKind() * 4; - if (auto cplx{t.dyn_cast()}) - return cplx.getFKind() * 4; llvm_unreachable("not a floating-point type"); } @@ -459,14 +457,6 @@ ? Conversion::Narrow : Conversion::Extend; } - if (auto fromCplxTy{from.dyn_cast()}) { - if (auto toCplxTy{to.dyn_cast()}) { - return getFloatingPointWidth(fromCplxTy) > - getFloatingPointWidth(toCplxTy) - ? Conversion::Narrow - : Conversion::Extend; - } - } // Notes: // - No conversion between character types, specialization of runtime // functions should be made instead. @@ -1084,8 +1074,7 @@ auto arg = args[0]; Fortran::lower::CharacterExprHelper helper{builder, loc}; auto dataAndLen = helper.createUnboxChar(arg); - auto charType = fir::CharacterType::get( - builder.getContext(), helper.getCharacterKind(arg.getType())); + fir::CharacterType charType; auto refType = builder.getRefType(charType); auto charAddr = builder.createConvert(loc, refType, dataAndLen.first); auto charVal = builder.create(loc, charType, charAddr); Index: flang/lib/Lower/Mangler.cpp =================================================================== --- flang/lib/Lower/Mangler.cpp +++ flang/lib/Lower/Mangler.cpp @@ -134,9 +134,6 @@ if (auto i{t.dyn_cast()}) { return "i" + std::to_string(i.getWidth()); } - if (auto cplx{t.dyn_cast()}) { - return "z" + std::to_string(cplx.getFKind()); - } if (auto real{t.dyn_cast()}) { return "r" + std::to_string(real.getFKind()); }