diff options
author | Kareem Ergawy <kareem.ergawy@amd.com> | 2024-03-11 10:38:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-11 10:38:28 +0100 |
commit | 3b30559c088d679ca8fe491158e6c32db630f223 (patch) | |
tree | a49337ceafe772cb9821c1ec83d4df1ae4339cf5 /flang/lib/Lower/Bridge.cpp | |
parent | 0f501c30b9601627c236f9abca8a3befba5dc161 (diff) | |
download | llvm-3b30559c088d679ca8fe491158e6c32db630f223.zip llvm-3b30559c088d679ca8fe491158e6c32db630f223.tar.gz llvm-3b30559c088d679ca8fe491158e6c32db630f223.tar.bz2 |
[flang][OpenMP] Only use HLFIR base in privatization logic (#84123)
Modifies the privatization logic so that the emitted code only used the
HLFIR base (i.e. SSA value `#0` returned from `hlfir.declare`). Before
that, that emitted privatization logic was a mix of using `#0` and `#1`
which leads to some difficulties trying to move to delayed privatization
(see the discussion on #84033).
Diffstat (limited to 'flang/lib/Lower/Bridge.cpp')
-rw-r--r-- | flang/lib/Lower/Bridge.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index 8048693..a668ba4 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -618,7 +618,8 @@ public: assert(details && "No host-association found"); const Fortran::semantics::Symbol &hsym = details->symbol(); mlir::Type hSymType = genType(hsym); - Fortran::lower::SymbolBox hsb = lookupSymbol(hsym); + Fortran::lower::SymbolBox hsb = + lookupSymbol(hsym, /*symMap=*/nullptr, /*forceHlfirBase=*/true); auto allocate = [&](llvm::ArrayRef<mlir::Value> shape, llvm::ArrayRef<mlir::Value> typeParams) -> mlir::Value { @@ -727,7 +728,8 @@ public: void createHostAssociateVarCloneDealloc( const Fortran::semantics::Symbol &sym) override final { mlir::Location loc = genLocation(sym.name()); - Fortran::lower::SymbolBox hsb = lookupSymbol(sym); + Fortran::lower::SymbolBox hsb = + lookupSymbol(sym, /*symMap=*/nullptr, /*forceHlfirBase=*/true); fir::ExtendedValue hexv = symBoxToExtendedValue(hsb); hexv.match( @@ -960,13 +962,14 @@ private: /// Find the symbol in the local map or return null. Fortran::lower::SymbolBox lookupSymbol(const Fortran::semantics::Symbol &sym, - Fortran::lower::SymMap *symMap = nullptr) { + Fortran::lower::SymMap *symMap = nullptr, + bool forceHlfirBase = false) { symMap = symMap ? symMap : &localSymbols; if (lowerToHighLevelFIR()) { if (std::optional<fir::FortranVariableOpInterface> var = symMap->lookupVariableDefinition(sym)) { - auto exv = - hlfir::translateToExtendedValue(toLocation(), *builder, *var); + auto exv = hlfir::translateToExtendedValue(toLocation(), *builder, *var, + forceHlfirBase); return exv.match( [](mlir::Value x) -> Fortran::lower::SymbolBox { return Fortran::lower::SymbolBox::Intrinsic{x}; |