[Bug target/126454] [16/17 Regression] RISCV: cm.popretz pass deletes "li a0,0" and gives wrong return value
wren6991 at gmail dot com via Gcc-bugs <[email protected]> Tue, 04 Aug 2026 09:26:32 +0000
| Newsgroups | gmane.comp.gcc.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D126454 --- Comment #9 from Luke Wren <wren6991 at gmail dot com> --- Going through the history a bit: * 7a345d0314 (Jul 9th 2024) fixed PR113715 by deleting cm.popretz recogniti= on from epilogue expansion * c738d4ef52 (Nov 5th 2025) introduced a new RTL pass to recognise cm.popre= tz using backward BB scan (trying to fix the size regression from 7a345d0314) There are no changes to the cm.popretz pass since c738d4ef52 so I think it = has been broken since that commit. I think this is just an oversight in the new pass: it does a backward BB sc= an to find a related `li a0, 0` but misses that CALL instructions are consider= ed part of the BB, and can consume and/or clobber a0.=