Skip to content

feat: add control flow branch interface - #1237

Merged
math-fehr merged 5 commits into
opencompl:mainfrom
axelcool1234:branch-op-interface
Aug 18, 2026
Merged

feat: add control flow branch interface#1237
math-fehr merged 5 commits into
opencompl:mainfrom
axelcool1234:branch-op-interface

Conversation

@axelcool1234

@axelcool1234 axelcool1234 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Implemented a very simple interface for branch operations. I skipped a lot of extra stuff (such as supporting branch ops that produce operands internally by the branch op - something VeIR has none of right now) that's in here: https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Interfaces/ControlFlowInterfaces.h but it's a start. This will help #854 which would use this interface. The reason SuccessorOperands is a one field structure is to later have additional fields like the number of produced operands like I mentioned. Right now it'd be unused so I left it as is.

@math-fehr math-fehr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can you move getSuccessorOperands to HasOpInfo though? And just return an Array ValuePtr?

Comment thread Veir/Interfaces/ControlFlowInterfaces.lean Outdated
Comment thread Veir/Interfaces/ControlFlowInterfaces.lean
Comment thread Veir/Interfaces/ControlFlowInterfaces.lean Outdated
@regehr

regehr commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

looks nice overall but I definitely agree that the dialect-specific parts of this need to be pushed into the dialect files

@regehr

regehr commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

also use a WfIRContext instead of a raw context?

@axelcool1234

axelcool1234 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

also use a WfIRContext instead of a raw context?

None of the other interfaces I've looked at does this

looks nice overall but I definitely agree that the dialect-specific parts of this need to be pushed into the dialect files

Will do, I'll move things around

Comment thread Veir/Interfaces/ControlFlowInterfaces.lean Outdated

@math-fehr math-fehr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay nice, I just have some comments on the notation then (since you are removing the checks that are not necessary). And then that should be good!

Comment thread Veir/Interfaces/ControlFlowInterfaces.lean Outdated
Comment thread Veir/Interfaces/ControlFlowInterfaces.lean Outdated
@axelcool1234
axelcool1234 requested a review from math-fehr August 17, 2026 20:28

@math-fehr math-fehr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Sorry I just have one last request, but I'll merge it right after!

Comment thread Veir/Interfaces/ControlFlowInterfaces.lean
@axelcool1234
axelcool1234 requested a review from math-fehr August 18, 2026 20:56
@math-fehr

Copy link
Copy Markdown
Collaborator

Thanks!

@math-fehr
math-fehr added this pull request to the merge queue Aug 18, 2026
Merged via the queue into opencompl:main with commit b7943ca Aug 18, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants