[Mlir-commits] [mlir] Extend `getBackwardSlice` to track values captured from above (PR #113478)
Ian Wood
llvmlistbot at llvm.org
Tue Oct 29 20:59:04 PDT 2024
================
@@ -115,6 +116,19 @@ static void getBackwardSliceImpl(Operation *op,
}
}
+ // Visit values that are defined above.
+ if (!options.omitUsesFromAbove) {
+ visitUsedValuesDefinedAbove(op->getRegions(), [&](OpOperand *operand) {
+ if (Operation *definingOp = operand->get().getDefiningOp()) {
+ getBackwardSliceImpl(definingOp, backwardSlice, options);
+ return;
+ }
+ Operation *bbAargOwner =
----------------
IanWood1 wrote:
I realized that I was duplicating all the logic within the for loop going over the operands. Instead, I changed it to iterate over a SetVector of the operands + used values defined above, which decreases logic duplication. However, this does mean we have to allocate space to store the operands in the `SetVector`. But _maybe_ this is fine?
https://github.com/llvm/llvm-project/pull/113478
More information about the Mlir-commits
mailing list