Landing: 874c7fcb444f

Project / Subsystem

gcc / RISC-V

Date

2026-09-08

Author

Wang Yaduo

Commit

874c7fcb444f67459dcf5156c6343031466c89b8

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
RISC-V
patch_id
—
commit_hash
874c7fcb444f67459dcf5156c6343031466c89b8
source_type
github
headline
RISC-V: Avoid vector adjustments for scalar costing
tldr
Fixes incorrect cost calculations for scalar operations on RISC-V by preventing vectorization cost adjustments.
author
Wang Yaduo
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • RISC-V
  • • optimization
  • • vectorization
  • • costing
discussion_id_link
—
bugzilla_pr
—
date
2026-09-08T00:00:00.000Z

A bug in the RISC-V backend caused scalar operations to incur incorrect cost adjustments intended for vector operations. This occurred when recovering scalar types from vector-typed expressions, leading to misapplied scaling factors and suboptimal instruction selection. The fix ensures that vector-specific cost adjustments are skipped when computing costs for scalar code, preventing issues like the expansion of a constructor through large stack temporaries and the loss of intended vector instructions.