Latest Results
Refactor `InstOp::GetConfig` for consistency (#7656)
## Description
This PR refactors the implementation of the `InstOp::GetConfig`
instruction to make it consistent with the implementations of
`GetLocal`, `GetGlobal`, and `GetStorageKey` instructions. Having
implementations consistent reduces unnecessary effort in understanding
why `GetConfig` is different and how it works, especially when reading
the code for the first time.
The `InstOp::GetConfig` instruction was the only instruction that kept a
reference to the compiled programs `Module` as well as a parameter of
type `String`. The `Module` parameter is used in only one place to
retreive the type of the configurable and is otherwise ignored (`_`).
All other instructions exclusively keep their arena values. This
inconsistency required additional effort when reading and understanding
code. Moreover, what the instruction conceptually does, is the same as
the `GetLocal`, `GetGlobal`, and `GetStorageKey` instructions.
## Checklist
- [ ] I have linked to any relevant issues.
- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers. Improve CSE pass by adding `get_local/global/config/storage_key` (#7655)
## Description
This PR improves Common Subexpression Elimination (CSE) pass by adding
`get_local`, `get_global`, `get_config`, and `get_storage_key` to the
expressions that are always congruent.
An address of a local, global, configurable, or storage key is invariant
within a function. E.g., two `get_local` of the same local are always
congruent regardless of program point, and the same is with
`get_global`, `get_config` and `get_storage_key`.
Improved CSE produces in average 4.45% less gas in o2 benchmarks and
2.37% more matches in max matches benchmark.
The improvement for locals and globals was first proposed by @Voxelot,
as a result of investigation of potential performance improvements done
by Claude Fable 5.
## Checklist
- [ ] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
---------
Co-authored-by: Voxelot <brandonkite92@gmail.com> Latest Branches
-19%
ironcev/refactor-get-config -20%
xunilrj/improve-rawptr-write -1%
Dnreikronos:typecheck/self_param_missing_error © 2026 CodSpeed Technology