[llvm-branch-commits] [flang] [flang][OpenMP] lower simple array reductions (PR #84958)

David Truby via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 15 07:59:01 PDT 2024


================
@@ -390,15 +559,35 @@ void ReductionProcessor::addReductionDecl(
 
   // initial pass to collect all recuction vars so we can figure out if this
   // should happen byref
+  fir::FirOpBuilder &builder = converter.getFirOpBuilder();
   for (const Fortran::parser::OmpObject &ompObject : objectList.v) {
     if (const auto *name{
             Fortran::parser::Unwrap<Fortran::parser::Name>(ompObject)}) {
       if (const Fortran::semantics::Symbol * symbol{name->symbol}) {
         if (reductionSymbols)
           reductionSymbols->push_back(symbol);
         mlir::Value symVal = converter.getSymbolAddress(*symbol);
-        if (auto declOp = symVal.getDefiningOp<hlfir::DeclareOp>())
+        auto redType = mlir::cast<fir::ReferenceType>(symVal.getType());
----------------
DavidTruby wrote:

Is this cast definitely safe? Will symVal always be a reference type here? 

https://github.com/llvm/llvm-project/pull/84958


More information about the llvm-branch-commits mailing list