This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][cf] Add branch operand edition function to cf.cond_br
AbandonedPublic

Authored by Tyker on Mar 31 2022, 9:02 PM.

Details

Diff Detail

Event Timeline

Tyker created this revision.Mar 31 2022, 9:02 PM
Tyker created this object with visibility "No One".
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 9:02 PM
Tyker requested review of this revision.Mar 31 2022, 9:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 9:02 PM
Tyker added a comment.Mar 31 2022, 9:07 PM

is there interest in having this upstream ?
I am not sure how it should be tested upstream ?

for context I needed this to build a pass that remove all cross block uses and instead pass all value by block arguments. there is not no support for switch ops because they never happen in my context so i don't know if it can be up-streamed as a test.

Tyker changed the visibility from "No One" to "Public (No Login Required)".
rriddle added a comment.EditedMar 31 2022, 9:42 PM

CondBranchOp has getTrueDestOperandsMutable() and getFalseDestOperandsMutable() methods that return a MutableOperandRange. That class is what we should be using, as it has support for assignment/erasing/etc. We can extend MutableOperandRange if some necessary functionality is missing.

Switch op provides similar functions for accessing the MutableOperandRange (e.g. getCaseOperandsMutable)

Tyker abandoned this revision.Mar 31 2022, 9:49 PM

I didn't realize this existed. thank you for the information.

I didn't realize this existed. thank you for the information.

Please feel free to open a patch adding any necessary functionality to MutableOperandRange! It's possible it might be missing something useful, so patches definitely welcome.