[flang-commits] [flang] [flang][openacc] Do not loose attributes on folding (PR #80516)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Fri Feb 2 16:38:20 PST 2024


================
@@ -36,6 +37,18 @@ namespace {
 #include "flang/Optimizer/Dialect/CanonicalizationPatterns.inc"
 } // namespace
 
+static void propagateAttributes(mlir::Operation *fromOp,
+                                mlir::Operation *toOp) {
+  if (!fromOp || !toOp)
+    return;
+
+  for (mlir::NamedAttribute attr : fromOp->getAttrs()) {
+    if (attr.getName().str().rfind(
----------------
vzakhari wrote:

nit: can we use `starts_with` here to make it more readable?

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


More information about the flang-commits mailing list