File tree Expand file tree Collapse file tree 4 files changed +14
-13
lines changed
include/flang/Optimizer/Support
mlir/lib/Target/LLVMIR/Dialect/OpenMP Expand file tree Collapse file tree 4 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -200,11 +200,6 @@ std::optional<llvm::ArrayRef<int64_t>> getComponentLowerBoundsIfNonDefault(
200200 fir::RecordType recordType, llvm::StringRef component,
201201 mlir::ModuleOp module , const mlir::SymbolTable *symbolTable = nullptr );
202202
203- // Convert FIR type to LLVM without turning fir.box<T> into memory
204- // reference.
205- mlir::Type convertObjectType (const fir::LLVMTypeConverter &converter,
206- mlir::Type firType);
207-
208203// / Generate a LLVM constant value of type `ity`, using the provided offset.
209204mlir::LLVM::ConstantOp
210205genConstantIndex (mlir::Location loc, mlir::Type ity,
Original file line number Diff line number Diff line change @@ -127,6 +127,15 @@ struct PrivateClauseOpConversion
127127 }
128128};
129129
130+ // Convert FIR type to LLVM without turning fir.box<T> into memory
131+ // reference.
132+ static mlir::Type convertObjectType (const fir::LLVMTypeConverter &converter,
133+ mlir::Type firType) {
134+ if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(firType))
135+ return converter.convertBoxTypeAsStruct (boxTy);
136+ return converter.convertType (firType);
137+ }
138+
130139// FIR Op specific conversion for TargetAllocMemOp
131140struct TargetAllocMemOpConversion
132141 : public OpenMPFIROpConversion<mlir::omp::TargetAllocMemOp> {
@@ -139,7 +148,7 @@ struct TargetAllocMemOpConversion
139148 mlir::Location loc = allocmemOp.getLoc ();
140149 auto ity = lowerTy ().indexType ();
141150 mlir::Type dataTy = fir::unwrapRefType (heapTy);
142- mlir::Type llvmObjectTy = fir:: convertObjectType (lowerTy (), dataTy);
151+ mlir::Type llvmObjectTy = convertObjectType (lowerTy (), dataTy);
143152 if (fir::isRecordWithTypeParameters (fir::unwrapSequenceType (dataTy)))
144153 TODO (loc, " omp.target_allocmem codegen of derived type with length "
145154 " parameters" );
Original file line number Diff line number Diff line change @@ -51,13 +51,6 @@ std::optional<llvm::ArrayRef<int64_t>> fir::getComponentLowerBoundsIfNonDefault(
5151 return std::nullopt ;
5252}
5353
54- mlir::Type fir::convertObjectType (const fir::LLVMTypeConverter &converter,
55- mlir::Type firType) {
56- if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(firType))
57- return converter.convertBoxTypeAsStruct (boxTy);
58- return converter.convertType (firType);
59- }
60-
6154mlir::LLVM::ConstantOp
6255fir::genConstantIndex (mlir::Location loc, mlir::Type ity,
6356 mlir::ConversionPatternRewriter &rewriter,
Original file line number Diff line number Diff line change @@ -5835,6 +5835,10 @@ static bool isTargetDeviceOp(Operation *op) {
58355835 if (mlir::isa<omp::ThreadprivateOp>(op))
58365836 return true ;
58375837
5838+ if (mlir::isa<omp::TargetAllocMemOp>(op) ||
5839+ mlir::isa<mp::TargetFreeMemOp>(op))
5840+ return true ;
5841+
58385842 if (auto parentFn = op->getParentOfType <LLVM::LLVMFuncOp>())
58395843 if (auto declareTargetIface =
58405844 llvm::dyn_cast<mlir::omp::DeclareTargetInterface>(
You can’t perform that action at this time.
0 commit comments