On Wed, Sep 9, 2026 at 2:04 PM Aldy Hernandez <[email protected]> wrote: > > On Wed, Sep 09, 2026 at 01:02:59PM +0200, Richard Biener wrote: > > On Tue, 8 Sep 2026, Aldy Hernandez wrote: > > > > > [This is a patch series to improve the back threader performance. With > > > it the threader is 12% faster.] > > > > > > The backwards threader marks blocks visited while walking a candidate > > > path with a hash_set<basic_block>, which costs a hash lookup on both > > > entry to and exit from every node. The set is only ever used to test > > > membership of a block of the current function, and the CFG does not > > > change during the search, so a sbitmap indexed by bb->index is > > > cleaner. > > > > > > The function find_paths_to_names clears the bit it set on every exit > > > path so the per-block reset in maybe_thread_block is redundant. > > > > > > Measured in perf instructions retired over our stage1 .ii corpus, this > > > drops back_threader::thread_blocks() by 2.2% (pass_thread_jumps 2.4%, > > > pass_thread_jumps_full 1.1%, pass_early_thread_jumps 2.2%) and the > > > whole compile by 0.02% over 806 TUs. > > > > > > Tested on ppc64le Linux. The assembly is identical over the .ii > > > files, so this is a NFC. > > > > > > OK? > > > > I'll note an even cheaper way is > > > > auto_bb_flag m_visited_flag; > > > > and > > > > bb->flags |= m_visited_flag; > > > > and > > > > bb->flags &= ~m_visited_flag; > > Ooooo, I like it. > > OK as attached pending tests?
OK. Richard. > > Aldy
