rtl-optimization/109237 - speedup bb_is_just_return
Commit Message
For the testcase bb_is_just_return is on top of the profile, changing
it to walk BB insns backwards puts it off the profile. That's because
in the forward walk you have to process possibly many debug insns
but in a backward walk you very likely run into control insns first.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
OK?
For the record, the profile was (after the delete_trivially_dead_insns
fix)
Samples: 289K of event 'cycles:u', Event count (approx.): 384226334976
Overhead Samples Command Shared Object Symbol
3.52% 9747 cc1 cc1 [.] bb_is_just_return
#
and after the fix bb_is_just_return has no recorded samples anymore.
Thanks,
Richard.
PR rtl-optimization/109237
* cfgcleanup.cc (bb_is_just_return): Walk insns backwards.
---
gcc/cfgcleanup.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -2608,7 +2608,7 @@ bb_is_just_return (basic_block bb, rtx_insn **ret, rtx_insn **use)
if (bb == EXIT_BLOCK_PTR_FOR_FN (cfun))
return false;
- FOR_BB_INSNS (bb, insn)
+ FOR_BB_INSNS_REVERSE (bb, insn)
if (NONDEBUG_INSN_P (insn))
{
rtx pat = PATTERN (insn);