Skip to content

Conversation

@sueszli
Copy link
Contributor

@sueszli sueszli commented Jan 26, 2026

Allows not just generic format:

"llvm.func"() <{
  sym_name = "binops",
  function_type = !llvm.func<void (i32, i32, f32, f32)>,
  CConv = #llvm.cconv<ccc>,
  linkage = #llvm.linkage<external>,
  visibility_ = 0 : i64
}> ({
^bb0(%arg0 : i32, %arg1 : i32, %arg2 : f32, %arg3 : f32):
  %0 = llvm.add %arg0, %arg1 : i32
  // ... ops ...
  "llvm.return"() : () -> ()
}) : () -> ()

But also a prettier custom format:

llvm.func @binops(%arg0: i32, %arg1: i32, %arg2: f32, %arg3: f32) {
  %0 = llvm.add %arg0, %arg1 : i32
  %1 = llvm.fadd %arg2, %arg3 : f32
  // ... ops ...
  llvm.return
}

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

❌ Patch coverage is 80.85106% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.15%. Comparing base (b230f09) to head (f120376).

Files with missing lines Patch % Lines
xdsl/dialects/llvm.py 65.21% 10 Missing and 6 partials ⚠️
xdsl/dialects/utils/format.py 95.83% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5588      +/-   ##
==========================================
- Coverage   86.16%   86.15%   -0.02%     
==========================================
  Files         394      394              
  Lines       56390    56461      +71     
  Branches     6496     6514      +18     
==========================================
+ Hits        48588    48642      +54     
- Misses       6269     6279      +10     
- Partials     1533     1540       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sueszli
Copy link
Contributor Author

sueszli commented Jan 26, 2026

Note to self: Increase coverage

@superlopuh superlopuh added the dialects Changes on the dialects label Jan 30, 2026
@sueszli
Copy link
Contributor Author

sueszli commented Jan 31, 2026

Todo:

  • increasing coverage
  • figuring out the right function_type

sym_visibility=visibility,
body=region,
other_props={
**(extra_attrs.data if extra_attrs else {}),
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be set as attributes? Can you please add a test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: 6f2b588 (I believe)?

Copy link
Member

Choose a reason for hiding this comment

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

Not quite, can you please add an attribute dictionary with something like {hello = "world} and test that it's parsed and re-printed correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the clear example - now I suddenly see what you meant!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: f120376

Copy link
Member

Choose a reason for hiding this comment

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

were these changes intended to be included in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They could be a seperate PR where I just try to maximize coverage. I agree. This is getting very confusing.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm wondering what you mean. Do you mean coverage of the llvm.py file, or the diff for adding custom syntax for llvm functions? If coverage of llvm.py, then that's great but should be in a separate PR. The pytest tests don't depend on custom syntax for llvm.func

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - the coverage of the llvm.py file. I'll revert the unnecessary tests here and make a new PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: #5603

Copy link
Member

Choose a reason for hiding this comment

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

this seems like a spurious change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was intentional - just aggressively trying to maximize coverage. But it's a bit pointless.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved: 7f17ee4

# Conflicts:
#	tests/filecheck/dialects/llvm/func.mlir
#	tests/filecheck/mlir-conversion/with-mlir/dialects/llvm/func.mlir
@sueszli
Copy link
Contributor Author

sueszli commented Feb 2, 2026

Moved the pretty llvm.return and coverage tests into a seperate PR.

This PR should be more focused now.

Will resolve open comments within this PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dialects Changes on the dialects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants