[flang] Use value_or (NFC)
This commit is contained in:
parent
685775bbab
commit
c715e2ff92
|
@ -252,12 +252,10 @@ public:
|
|||
rewriter.setInsertionPoint(mem);
|
||||
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
||||
bool isPinned = mem.getPinned();
|
||||
llvm::StringRef uniqName;
|
||||
if (mem.getUniqName())
|
||||
uniqName = mem.getUniqName().getValue();
|
||||
llvm::StringRef bindcName;
|
||||
if (mem.getBindcName())
|
||||
bindcName = mem.getBindcName().getValue();
|
||||
llvm::StringRef uniqName =
|
||||
mem.getUniqName().value_or(llvm::StringRef());
|
||||
llvm::StringRef bindcName =
|
||||
mem.getBindcName().value_or(llvm::StringRef());
|
||||
rewriter.replaceOpWithNewOp<AllocaOp>(
|
||||
mem, toTy, uniqName, bindcName, isPinned, mem.getTypeparams(),
|
||||
mem.getShape());
|
||||
|
@ -267,12 +265,10 @@ public:
|
|||
if (typeConverter.needsConversion(ty)) {
|
||||
rewriter.setInsertionPoint(mem);
|
||||
auto toTy = typeConverter.convertType(unwrapRefType(ty));
|
||||
llvm::StringRef uniqName;
|
||||
if (mem.getUniqName())
|
||||
uniqName = mem.getUniqName().getValue();
|
||||
llvm::StringRef bindcName;
|
||||
if (mem.getBindcName())
|
||||
bindcName = mem.getBindcName().getValue();
|
||||
llvm::StringRef uniqName =
|
||||
mem.getUniqName().value_or(llvm::StringRef());
|
||||
llvm::StringRef bindcName =
|
||||
mem.getBindcName().value_or(llvm::StringRef());
|
||||
rewriter.replaceOpWithNewOp<AllocMemOp>(
|
||||
mem, toTy, uniqName, bindcName, mem.getTypeparams(),
|
||||
mem.getShape());
|
||||
|
|
|
@ -2679,9 +2679,7 @@ struct GlobalOpConversion : public FIROpConversion<fir::GlobalOp> {
|
|||
if (global.getType().isa<fir::BoxType>())
|
||||
tyAttr = tyAttr.cast<mlir::LLVM::LLVMPointerType>().getElementType();
|
||||
auto loc = global.getLoc();
|
||||
mlir::Attribute initAttr;
|
||||
if (global.getInitVal())
|
||||
initAttr = global.getInitVal().getValue();
|
||||
mlir::Attribute initAttr = global.getInitVal().value_or(mlir::Attribute());
|
||||
auto linkage = convertLinkage(global.getLinkName());
|
||||
auto isConst = global.getConstant().has_value();
|
||||
auto g = rewriter.create<mlir::LLVM::GlobalOp>(
|
||||
|
|
Loading…
Reference in New Issue