[Mlir-commits] [mlir] [mlir][scf]: Copy old attributes of old ForOp in replaceWithAdditionalYields (PR #95502)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jun 13 21:19:09 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Aviad Cohen (AviadCo)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/95502.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/SCF/IR/SCF.cpp (+2) 


``````````diff
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 524711dbbb6fd..de3e5ef530e0c 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -588,8 +588,10 @@ ForOp::replaceWithAdditionalYields(RewriterBase &rewriter,
   }
 
   // Replace the old loop.
+  auto attrs = SmallVector<NamedAttribute, 4>(getOperation()->getAttrs());
   rewriter.replaceOp(getOperation(),
                      newLoop->getResults().take_front(getNumResults()));
+  newLoop->setAttrs(attrs);
   return cast<LoopLikeOpInterface>(newLoop.getOperation());
 }
 

``````````

</details>


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


More information about the Mlir-commits mailing list