Landing: 2415f291466d

Project / Subsystem

gcc / arm

Date

2026-06-09

Author

Ciprian Arbone

Commit

2415f291466dc93182b64e6f069dd0015862e70f

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
arm
patch_id
commit_hash
2415f291466dc93182b64e6f069dd0015862e70f
source_type
github
headline
ARM Thumb-1 CBZ conditional branch tracking is fixed
tldr
GCC's ARM backend for Thumb-1 now correctly tracks condition codes for CBZ instructions, preventing redundant CMP instructions.
author
Ciprian Arbone
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • arm
  • thumb
  • bugfix
  • code generation
  • optimization
discussion_id_link
bugzilla_pr
date
2026-06-09T00:00:00.000Z

This commit fixes a bug in the GCC ARM backend affecting Thumb-1 CBZ (Compare and Branch if Zero) instructions. Previously, the compiler’s condition code tracking mechanism incorrectly used the jump target label instead of the actual zero operand when checking for reusable condition codes. This led to the generation of redundant CMP instructions before a CBZ. The fix ensures that CBZ is properly recognized as a conditional branch, allowing the compiler to correctly track condition code state and avoid unnecessary instructions, resulting in smaller and more efficient Thumb-1 code.