Skip to content

Conversation

@jennyQuantinuum
Copy link
Contributor

Closes: https://github.com/quantinuum-dev/eldarion/issues/360

In hugr-llvm, sets default llvm function linkage based on the newly added Visibility field in hugr node.

Additional detail

The current hugr-llvm defaults function linkage to None, and as a result, after inlining passes, some deadcode (such as qsystem helper functions) cannot be eliminated by deadcode elimination passes.

Setting the llvm function linkage based on Visibility field will mark the qsystem helper functions with Private linkage, allowing them to be removed by deadcode elimination passes.

@codecov
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.67%. Comparing base (4a06073) to head (c1414a0).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
hugr-llvm/src/emit.rs 93.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2502   +/-   ##
=======================================
  Coverage   82.67%   82.67%           
=======================================
  Files         251      251           
  Lines       46661    46673   +12     
  Branches    42190    42202   +12     
=======================================
+ Hits        38576    38587   +11     
- Misses       6034     6035    +1     
  Partials     2051     2051           
Flag Coverage Δ
python 91.38% <ø> (ø)
rust 81.75% <93.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@jennyQuantinuum jennyQuantinuum marked this pull request as ready for review July 31, 2025 21:20
@jennyQuantinuum jennyQuantinuum requested a review from a team as a code owner July 31, 2025 21:20
@aborgna-q aborgna-q changed the title fix: hugr-llvm: Set llvm function linkage based on Visibility hugr node field fix(hugr-llvm): Set llvm function linkage based on Visibility hugr node field Aug 6, 2025
@aborgna-q aborgna-q enabled auto-merge August 6, 2025 12:28
@aborgna-q aborgna-q added this pull request to the merge queue Aug 6, 2025
Merged via the queue into main with commit 7927acd Aug 6, 2025
27 checks passed
@aborgna-q aborgna-q deleted the jenny/deadcode_issue_visibility branch August 6, 2025 12:33
@hugrbot hugrbot mentioned this pull request Aug 6, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2025
## 🤖 New release

* `hugr-model`: 0.22.1 -> 0.23.0 (✓ API compatible changes)
* `hugr-core`: 0.22.1 -> 0.23.0 (⚠ API breaking changes)
* `hugr-llvm`: 0.22.1 -> 0.23.0 (✓ API compatible changes)
* `hugr-passes`: 0.22.1 -> 0.23.0 (✓ API compatible changes)
* `hugr-persistent`: 0.2.1 -> 0.2.2 (✓ API compatible changes)
* `hugr`: 0.22.1 -> 0.23.0 (✓ API compatible changes)
* `hugr-cli`: 0.22.1 -> 0.23.0 (✓ API compatible changes)

### ⚠ `hugr-core` breaking changes

```text
--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/struct_missing.ron

Failed in:
  struct hugr_core::hugr::views::sibling_subgraph::TopoConvexChecker, previously in file /tmp/.tmpA42bjc/hugr-core/src/hugr/views/sibling_subgraph.rs:601
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-model`

<blockquote>

##
[0.23.0](hugr-model-v0.22.1...hugr-model-v0.23.0)
- 2025-08-06

### New Features

- Type of constants in `core` `Term`s.
([#2411](#2411))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.23.0](hugr-core-v0.22.1...hugr-core-v0.23.0)
- 2025-08-06

### New Features

- Type of constants in `core` `Term`s.
([#2411](#2411))
- Support LineConvexChecker
([#2487](#2487))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.23.0](hugr-llvm-v0.22.1...hugr-llvm-v0.23.0)
- 2025-08-06

### Bug Fixes

- added public func getter for EmitFuncContext
([#2482](#2482))
- *(hugr-llvm)* Set llvm function linkage based on Visibility hugr node
field ([#2502](#2502))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.22.1](hugr-passes-v0.22.0...hugr-passes-v0.22.1)
- 2025-07-28

### New Features

- Include copy_discard_array in DelegatingLinearizer::default
([#2479](#2479))
- Inline calls to functions not on cycles in the call graph
([#2450](#2450))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.2.0](hugr-persistent-v0.1.0...hugr-persistent-v0.2.0)
- 2025-07-24

### New Features

- [**breaking**] Update portgraph dependency to 0.15
([#2455](#2455))
</blockquote>

## `hugr`

<blockquote>

##
[0.23.0](hugr-v0.22.1...hugr-v0.23.0)
- 2025-08-06

### New Features

- Type of constants in `core` `Term`s.
([#2411](#2411))
- Support LineConvexChecker
([#2487](#2487))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.23.0](hugr-cli-v0.22.1...hugr-cli-v0.23.0)
- 2025-08-06

### New Features

- *(cli)* Deprecate HugrInputArgs::get_hugr
([#2506](#2506))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Luca Mondada <[email protected]>
@hugrbot hugrbot mentioned this pull request Aug 8, 2025
github-merge-queue bot pushed a commit that referenced this pull request Sep 15, 2025
## 🤖 New release

* `hugr-model`: 0.22.2 -> 0.22.3 (✓ API compatible changes)
* `hugr-core`: 0.22.2 -> 0.22.3 (✓ API compatible changes)
* `hugr-llvm`: 0.22.2 -> 0.22.3 (✓ API compatible changes)
* `hugr-passes`: 0.22.2 -> 0.22.3 (✓ API compatible changes)
* `hugr-persistent`: 0.2.2 -> 0.2.3 (✓ API compatible changes)
* `hugr`: 0.22.2 -> 0.22.3 (✓ API compatible changes)
* `hugr-cli`: 0.22.2 -> 0.22.3 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-model`

<blockquote>

##
[0.22.2](hugr-model-v0.22.1...hugr-model-v0.22.2)
- 2025-08-06

### New Features

- Type of constants in `core` `Term`s.
([#2411](#2411))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.22.3](hugr-core-v0.22.2...hugr-core-v0.22.3)
- 2025-09-11

### Bug Fixes

- SiblingSubgraph::try_from_nodes not including disconnected components
([#2549](#2549))

### Documentation

- Clarify docs for SiblingSubgraph::{inputs, outputs}
([#2508](#2508))

### New Features

- SiblingSubgraph supports function calls
([#2528](#2528))
- Add unchecked constructor for SiblingSubgraph
([#2526](#2526))
- Add HugrMut::insert(_view)_forest
([#2518](#2518))
- Add extend_inputs function for DFGs
([#2536](#2536))
- Loosen bound on Patch trait
([#2545](#2545))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.22.2](hugr-llvm-v0.22.1...hugr-llvm-v0.22.2)
- 2025-08-06

### Bug Fixes

- added public func getter for EmitFuncContext
([#2482](#2482))
- *(hugr-llvm)* Set llvm function linkage based on Visibility hugr node
field ([#2502](#2502))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.22.3](hugr-passes-v0.22.2...hugr-passes-v0.22.3)
- 2025-09-11

### New Features

- SiblingSubgraph supports function calls
([#2528](#2528))
</blockquote>

## `hugr-persistent`

<blockquote>

##
[0.2.3](hugr-persistent-v0.2.2...hugr-persistent-v0.2.3)
- 2025-09-11

### Documentation

- Clarify docs for SiblingSubgraph::{inputs, outputs}
([#2508](#2508))

### New Features

- SiblingSubgraph supports function calls
([#2528](#2528))
</blockquote>

## `hugr`

<blockquote>

##
[0.22.3](hugr-v0.22.2...hugr-v0.22.3)
- 2025-09-11

### Bug Fixes

- SiblingSubgraph::try_from_nodes not including disconnected components
([#2549](#2549))

### Documentation

- Clarify docs for SiblingSubgraph::{inputs, outputs}
([#2508](#2508))

### New Features

- SiblingSubgraph supports function calls
([#2528](#2528))
- Add unchecked constructor for SiblingSubgraph
([#2526](#2526))
- Add extend_inputs function for DFGs
([#2536](#2536))
- Loosen bound on Patch trait
([#2545](#2545))
- Add HugrMut::insert(_view)_forest
([#2518](#2518))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.22.3](hugr-cli-v0.22.2...hugr-cli-v0.22.3)
- 2025-09-11

### New Features

- *(hugr-cli)* CliError::validate helper
([#2507](#2507))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
@hugrbot hugrbot mentioned this pull request Sep 16, 2025
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.

4 participants