File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
flang/lib/Optimizer/Builder Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -228,14 +228,15 @@ mlir::Operation* traverseConverts(mlir::Operation *op) {
228228}
229229
230230bool 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
You can’t perform that action at this time.
0 commit comments