Landing: 3f6fb81133df

Project / Subsystem

gcc / ifcvt

Date

2026-09-28

Author

Stian Halseth

Commit

3f6fb81133dfa2b8f843b328fd6b697534e7b3fe

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
ifcvt
patch_id
—
commit_hash
3f6fb81133dfa2b8f843b328fd6b697534e7b3fe
source_type
github
headline
ifcvt: Avoid clobbering live condition-code register
tldr
Fixes miscompilations on SPARC by preventing if-conversion from overwriting live condition codes.
author
Stian Halseth
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • ifcvt
  • • sparc
  • • compiler bug
discussion_id_link
—
bugzilla_pr
—
date
2026-09-28T00:00:00.000Z

The if-conversion pass’s find_cond_trap function has been updated to prevent it from overwriting a live condition-code register. Previously, on SPARC, this could lead to incorrect program behavior when a condition code set earlier in the code was needed by a later branch, causing miscompilations, particularly for switch statements with unreachable default cases. The fix reuses an existing check (noce_clobbers_live_cc_p) to ensure condition codes are not clobbered, resolving issues on SPARC64.