Landing: c80ac3cb559f

Project / Subsystem

gcc / risc-v

Date

2026-08-04

Author

Kito Cheng

Commit

c80ac3cb559f6ea2be6be3d0458c1615ff27c9a0

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
risc-v
patch_id
—
commit_hash
c80ac3cb559f6ea2be6be3d0458c1615ff27c9a0
source_type
github
headline
RISC-V: Prevent popretz optimization from crossing function calls.
tldr
Fixes RISC-V optimization that incorrectly deleted code across function calls.
author
Kito Cheng
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • RISC-V
  • • optimization
  • • compiler bug
discussion_id_link
—
bugzilla_pr
—
date
2026-08-04T00:00:00.000Z

A RISC-V optimization pass, combine_popretz, incorrectly deleted a li a0, 0 instruction when it occurred across a function call. This instruction was intended to set up the first argument for the called function or to clear register a0 before a return. The pass’s backward scan failed to stop at calls, mistaking argument setup for dead code. This commit corrects the scan to respect function call boundaries, preventing incorrect instruction deletion and ensuring correct argument passing and return values.