GCC Newspaper
OCTOBER 6, 2026
gcc — Proposed

Redundant return-only BB elimination

Proposes a patch to eliminate redundant return-only basic blocks in CFG cleanup.

Robert Guthrie proposes a new patch to address the elimination of redundant return-only basic blocks. This change aims to simplify the control flow graph by merging consecutive blocks that only contain a return instruction. The patch passes most tests, with a minor noted issue on a verbatim asm diff.

In Details

This patch modifies cfgcleanup.cc to optimize the control flow graph by removing redundant basic blocks that solely contain a return instruction. It aims to improve code efficiency by merging such blocks, redirecting predecessors to a single return block. The challenge lies in correctly handling CFG RTL modes during this optimization.

Filed Under: optimizationcfgriscv