[flang-commits] [flang] [MLIR, Flang, OpenMP] Remove usage of getElementType in OpenMPTranslation (PR #69772)

via flang-commits flang-commits at lists.llvm.org
Mon Oct 23 05:24:55 PDT 2023


================
@@ -156,6 +156,35 @@ struct AtomicReadOpConversion
   }
 };
 
+struct MapInfoOpConversion : public ConvertOpToLLVMPattern<omp::MapInfoOp> {
+  using ConvertOpToLLVMPattern<omp::MapInfoOp>::ConvertOpToLLVMPattern;
+  LogicalResult
+  matchAndRewrite(omp::MapInfoOp curOp, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    const TypeConverter *converter = ConvertToLLVMPattern::getTypeConverter();
+
+    SmallVector<Type> resTypes;
+    if (failed(converter->convertTypes(curOp->getResultTypes(), resTypes)))
+      return failure();
+
+    // Copy attributes of the curOp except for the typeAttr which should
+    // be converted
+    SmallVector<NamedAttribute> newAttrs;
+    for (auto attr : curOp->getAttrs()) {
+      if (auto typeAttr = dyn_cast<TypeAttr>(attr.getValue())) {
+        auto newAttr = converter->convertType(typeAttr.getValue());
----------------
agozillon wrote:

Nit: could also expand the auto here but not important 

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


More information about the flang-commits mailing list