[Mlir-commits] [mlir] [mlir][Hoisting] Hoisting vector.extract/vector.broadcast pairs (PR #86108)
Steven Varoumas
llvmlistbot at llvm.org
Fri Apr 19 03:38:23 PDT 2024
================
@@ -43,6 +43,121 @@ using llvm::dbgs;
using namespace mlir;
using namespace mlir::linalg;
+scf::ForOp replaceWithDifferentYield(RewriterBase &rewriter, scf::ForOp loop,
+ Value newInitOperand, int index,
+ Value newYieldValue) {
+ OpBuilder::InsertionGuard g(rewriter);
+ rewriter.setInsertionPoint(loop.getOperation());
+ auto inits = llvm::to_vector(loop.getInits());
+
+ // Replace the init value with the new operand
+ inits[index] = newInitOperand;
----------------
stevenvar wrote:
Added an assert `assert(index < inits.size());`
https://github.com/llvm/llvm-project/pull/86108
More information about the Mlir-commits
mailing list