diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -3950,8 +3950,9 @@ mlir::Value oldInnerArg = modifyOp.getSequence(); std::size_t offset = explicitSpace->argPosition(oldInnerArg); explicitSpace->setInnerArg(offset, fir::getBase(lexv)); - fir::ExtendedValue exv = arrayModifyToExv( - builder, loc, *explicitSpace->getLhsLoad(0), modifyOp.getResult(0)); + fir::ExtendedValue exv = + arrayModifyToExv(builder, loc, explicitSpace->getLhsLoad(0).value(), + modifyOp.getResult(0)); genScalarUserDefinedAssignmentCall(builder, loc, userAssignment, exv, elementalExv); } else { @@ -4101,7 +4102,7 @@ mlir::Value origVal) { mlir::Value val = builder.createConvert(loc, eleTy, origVal); if (isBoundsSpec()) { - auto lbs = *lbounds; + auto lbs = lbounds.value(); if (lbs.size() > 0) { // Rebox the value with user-specified shift. auto shiftTy = fir::ShiftType::get(eleTy.getContext(), lbs.size()); @@ -6368,7 +6369,7 @@ charLen = builder.createTemporary(loc, builder.getI64Type()); mlir::Value castLen = builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv)); - builder.create(loc, castLen, *charLen); + builder.create(loc, castLen, charLen.value()); } } stmtCtx.finalize(/*popScope=*/true); @@ -6382,7 +6383,7 @@ // Convert to extended value. if (fir::isa_char(seqTy.getEleTy())) { - auto len = builder.create(loc, *charLen); + auto len = builder.create(loc, charLen.value()); return {fir::CharArrayBoxValue{mem, len, extents}, /*needCopy=*/false}; } return {fir::ArrayBoxValue{mem, extents}, /*needCopy=*/false}; @@ -6450,7 +6451,7 @@ charLen = builder.createTemporary(loc, builder.getI64Type()); mlir::Value castLen = builder.createConvert(loc, builder.getI64Type(), fir::getLen(exv)); - builder.create(loc, castLen, *charLen); + builder.create(loc, castLen, charLen.value()); } } mem = builder.createConvert(loc, fir::HeapType::get(resTy), mem); diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -2818,7 +2818,7 @@ caseOp.getSuccessorOperands(adaptor.getOperands(), t); llvm::Optional cmpOps = *caseOp.getCompareOperands(adaptor.getOperands(), t); - mlir::Value caseArg = *(cmpOps->begin()); + mlir::Value caseArg = *(cmpOps.value().begin()); mlir::Attribute attr = cases[t]; if (attr.isa()) { auto cmp = rewriter.create( @@ -2847,7 +2847,7 @@ rewriter.setInsertionPointToEnd(thisBlock); rewriter.create(loc, cmp, newBlock1, newBlock2); rewriter.setInsertionPointToEnd(newBlock1); - mlir::Value caseArg0 = *(cmpOps->begin() + 1); + mlir::Value caseArg0 = *(cmpOps.value().begin() + 1); auto cmp0 = rewriter.create( loc, mlir::LLVM::ICmpPredicate::sle, selector, caseArg0); genCondBrOp(loc, cmp0, dest, destOps, rewriter, newBlock2);