-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Extend getBackwardSlice to track values captured from above
#113478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |||||||||
| #include "mlir/IR/Operation.h" | ||||||||||
| #include "mlir/Interfaces/SideEffectInterfaces.h" | ||||||||||
| #include "mlir/Support/LLVM.h" | ||||||||||
| #include "mlir/Transforms/RegionUtils.h" | ||||||||||
| #include "llvm/ADT/SetVector.h" | ||||||||||
| #include "llvm/ADT/SmallPtrSet.h" | ||||||||||
|
|
||||||||||
|
|
@@ -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 = | ||||||||||
|
||||||||||
| Operation *bbAargOwner = | |
| if (options.omitBlockArguments) | |
| return; | |
| Operation *bbAargOwner = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
Uh oh!
There was an error while loading. Please reload this page.