Skip to content

Commit c02651a

Browse files
committed
push lost mayBeOptional change
1 parent b8b72cd commit c02651a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

flang/lib/Optimizer/Builder/HLFIRTools.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,15 @@ mlir::Operation* traverseConverts(mlir::Operation *op) {
228228
}
229229

230230
bool hlfir::Entity::mayBeOptional() const {
231-
if (auto varIface = getIfVariableInterface())
232-
return varIface.isOptional();
233231
if (!isVariable())
234232
return false;
235233
// TODO: introduce a fir type to better identify optionals.
236-
if (mlir::Operation* op = traverseConverts(getDefiningOp()))
234+
if (mlir::Operation *op = traverseConverts(getDefiningOp())) {
235+
if (auto varIface = llvm::dyn_cast<fir::FortranVariableOpInterface>(op))
236+
return varIface.isOptional();
237237
return !llvm::isa<fir::AllocaOp, fir::AllocMemOp, fir::ReboxOp,
238-
fir::EmboxOp>(op);
238+
fir::EmboxOp, fir::LoadOp>(op);
239+
}
239240
return true;
240241
}
241242

0 commit comments

Comments
 (0)