@@ -1740,54 +1740,6 @@ createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc,
1740
1740
return op;
1741
1741
}
1742
1742
1743
- static mlir::omp::MapInfoOp processDescriptorTypeMappings (
1744
- Fortran::semantics::SemanticsContext &semanticsContext,
1745
- Fortran::lower::StatementContext &stmtCtx,
1746
- Fortran::lower::AbstractConverter &converter, mlir::Location loc,
1747
- mlir::Value descriptorAddr, mlir::Value descDataBaseAddr,
1748
- mlir::ValueRange bounds, std::string asFortran,
1749
- llvm::omp::OpenMPOffloadMappingFlags mapCaptureType) {
1750
- llvm::SmallVector<mlir::Value> descriptorBaseAddrMembers;
1751
- fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder ();
1752
-
1753
- mlir::Value descriptor = descriptorAddr;
1754
-
1755
- // The fir::BoxOffsetOp only works with !fir.ref<!fir.box<...>> types, as
1756
- // allowing it to access non-reference box operations can cause some
1757
- // problematic SSA IR. However, in the case of assumed shape's the type
1758
- // is not a !fir.ref, in these cases to retrieve the appropriate
1759
- // !fir.ref<!fir.box<...>> to access the data we need to map we must
1760
- // perform an alloca and then store to it and retrieve the data from the new
1761
- // alloca.
1762
- if (mlir::isa<fir::BaseBoxType>(descriptorAddr.getType ())) {
1763
- mlir::OpBuilder::InsertPoint insPt = firOpBuilder.saveInsertionPoint ();
1764
- firOpBuilder.setInsertionPointToStart (firOpBuilder.getAllocaBlock ());
1765
- descriptor =
1766
- firOpBuilder.create <fir::AllocaOp>(loc, descriptorAddr.getType ());
1767
- firOpBuilder.restoreInsertionPoint (insPt);
1768
- firOpBuilder.create <fir::StoreOp>(loc, descriptorAddr, descriptor);
1769
- }
1770
-
1771
- mlir::Value baseAddrAddr = firOpBuilder.create <fir::BoxOffsetOp>(
1772
- loc, descriptor, fir::BoxFieldAttr::base_addr);
1773
-
1774
- descriptorBaseAddrMembers.push_back (createMapInfoOp (
1775
- firOpBuilder, loc, descDataBaseAddr, baseAddrAddr, asFortran, bounds, {},
1776
- static_cast <std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
1777
- mapCaptureType),
1778
- mlir::omp::VariableCaptureKind::ByRef, descDataBaseAddr.getType ()));
1779
-
1780
- // TODO: map the addendum segment of the descriptor, similarly to the above
1781
- // base address/data pointer member.
1782
-
1783
- return createMapInfoOp (
1784
- firOpBuilder, loc, descriptor, mlir::Value{}, asFortran, {},
1785
- descriptorBaseAddrMembers,
1786
- static_cast <std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
1787
- mapCaptureType),
1788
- mlir::omp::VariableCaptureKind::ByRef, descriptor.getType ());
1789
- }
1790
-
1791
1743
bool ClauseProcessor::processMap (
1792
1744
mlir::Location currentLocation, const llvm::omp::Directive &directive,
1793
1745
Fortran::semantics::SemanticsContext &semanticsContext,
@@ -1857,24 +1809,20 @@ bool ClauseProcessor::processMap(
1857
1809
1858
1810
auto origSymbol =
1859
1811
converter.getSymbolAddress (*getOmpObjectSymbol (ompObject));
1860
- mlir::Value mapOp, symAddr;
1861
- if (origSymbol && fir::isTypeWithDescriptor (origSymbol.getType ())) {
1812
+ mlir::Value symAddr = info. addr ;
1813
+ if (origSymbol && fir::isTypeWithDescriptor (origSymbol.getType ()))
1862
1814
symAddr = origSymbol;
1863
- mapOp = processDescriptorTypeMappings (
1864
- semanticsContext, stmtCtx, converter, clauseLocation,
1865
- origSymbol, info.addr , bounds, asFortran.str (), mapTypeBits);
1866
- } else {
1867
- // Explicit map captures are captured ByRef by default,
1868
- // optimisation passes may alter this to ByCopy or other capture
1869
- // types to optimise
1870
- symAddr = info.addr ;
1871
- mapOp = createMapInfoOp (
1872
- firOpBuilder, clauseLocation, info.addr , mlir::Value{},
1873
- asFortran.str (), bounds, {},
1874
- static_cast <std::underlying_type_t <
1875
- llvm::omp::OpenMPOffloadMappingFlags>>(mapTypeBits),
1876
- mlir::omp::VariableCaptureKind::ByRef, info.addr .getType ());
1877
- }
1815
+
1816
+ // Explicit map captures are captured ByRef by default,
1817
+ // optimisation passes may alter this to ByCopy or other capture
1818
+ // types to optimise
1819
+ mlir::Value mapOp = createMapInfoOp (
1820
+ firOpBuilder, clauseLocation, symAddr, mlir::Value{},
1821
+ asFortran.str (), bounds, {},
1822
+ static_cast <
1823
+ std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
1824
+ mapTypeBits),
1825
+ mlir::omp::VariableCaptureKind::ByRef, symAddr.getType ());
1878
1826
1879
1827
mapOperands.push_back (mapOp);
1880
1828
if (mapSymTypes)
@@ -1989,22 +1937,20 @@ bool ClauseProcessor::processMotionClauses(
1989
1937
1990
1938
auto origSymbol =
1991
1939
converter.getSymbolAddress (*getOmpObjectSymbol (ompObject));
1992
- mlir::Value mapOp;
1993
- if (origSymbol && fir::isTypeWithDescriptor (origSymbol.getType ())) {
1994
- mapOp = processDescriptorTypeMappings (
1995
- semanticsContext, stmtCtx, converter, clauseLocation,
1996
- origSymbol, info.addr , bounds, asFortran.str (), mapTypeBits);
1997
- } else {
1998
- // Explicit map captures are captured ByRef by default,
1999
- // optimisation passes may alter this to ByCopy or other capture
2000
- // types to optimise
2001
- mapOp = createMapInfoOp (
2002
- firOpBuilder, clauseLocation, info.addr , mlir::Value{},
2003
- asFortran.str (), bounds, {},
2004
- static_cast <std::underlying_type_t <
2005
- llvm::omp::OpenMPOffloadMappingFlags>>(mapTypeBits),
2006
- mlir::omp::VariableCaptureKind::ByRef, info.addr .getType ());
2007
- }
1940
+ mlir::Value symAddr = info.addr ;
1941
+ if (origSymbol && fir::isTypeWithDescriptor (origSymbol.getType ()))
1942
+ symAddr = origSymbol;
1943
+
1944
+ // Explicit map captures are captured ByRef by default,
1945
+ // optimisation passes may alter this to ByCopy or other capture
1946
+ // types to optimise
1947
+ mlir::Value mapOp = createMapInfoOp (
1948
+ firOpBuilder, clauseLocation, symAddr, mlir::Value{},
1949
+ asFortran.str (), bounds, {},
1950
+ static_cast <
1951
+ std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
1952
+ mapTypeBits),
1953
+ mlir::omp::VariableCaptureKind::ByRef, symAddr.getType ());
2008
1954
2009
1955
mapOperands.push_back (mapOp);
2010
1956
}
@@ -2819,20 +2765,13 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
2819
2765
mapFlag |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
2820
2766
}
2821
2767
2822
- mlir::Value mapOp;
2823
- if (fir::isTypeWithDescriptor (baseOp.getType ())) {
2824
- mapOp = processDescriptorTypeMappings (
2825
- semanticsContext, stmtCtx, converter, baseOp.getLoc (), baseOp,
2826
- info.addr , bounds, name.str (), mapFlag);
2827
- } else {
2828
- mapOp = createMapInfoOp (
2829
- converter.getFirOpBuilder (), baseOp.getLoc (), baseOp,
2830
- mlir::Value{}, name.str (), bounds, {},
2831
- static_cast <
2832
- std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
2833
- mapFlag),
2834
- captureKind, baseOp.getType ());
2835
- }
2768
+ mlir::Value mapOp = createMapInfoOp (
2769
+ converter.getFirOpBuilder (), baseOp.getLoc (), baseOp, mlir::Value{},
2770
+ name.str (), bounds, {},
2771
+ static_cast <
2772
+ std::underlying_type_t <llvm::omp::OpenMPOffloadMappingFlags>>(
2773
+ mapFlag),
2774
+ captureKind, baseOp.getType ());
2836
2775
2837
2776
mapOperands.push_back (mapOp);
2838
2777
mapSymTypes.push_back (baseOp.getType ());
0 commit comments