Landing: e65d38a0dc84
Project / Subsystem
gcc / bpf
Date
2026-07-20
Author
Vineet Gupta
Commit
e65d38a0dc843d36dd5605c6805645923b44c6a7
Source
github
Perf win
No
Breaking
No
All attributes
- project
- gcc
- subsystem
- bpf
- patch_id
- —
- commit_hash
- e65d38a0dc843d36dd5605c6805645923b44c6a7
- source_type
- github
- headline
- bpf: Favor 32-bit constants over registers for return values
- tldr
- Adjusts BPF cost model to prefer immediate 32-bit constants for return values, improving verifier compatibility.
- author
- Vineet Gupta
- outcome
- committed
- performance_win
- false
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • bpf
- • cost model
- • verifier
- • optimization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-20T00:00:00.000Z
GCC’s BPF backend now treats 32-bit immediate constants as cheap or free when estimating instruction costs. This change encourages the compiler to use immediate constants for return values rather than relying on previously computed register values. The goal is to avoid potential issues with the BPF kernel verifier, such as extra sign-extensions, that can arise when constants are introduced through register initialization. This adjustment has already led to more BPF selftests passing.