https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108938
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Hongtao.liu from comment #11) > (In reply to Jakub Jelinek from comment #9) > > Though, if more than one replacement operation is emitted, one needs to be > > careful not to emit more expensive replacement than the original sequence > > (especially if some subexpressions aren't single use). > > The patch(support swap + bit_and + rotate) doesn't show much impact on > SPEC2017, is there any other benchmark that I can try to find some > performance regressiones with bswap + bit_and + rotate? > So that I'll restrict the patch to only bswp + rotate/shift. I didn't mean to look at SPEC numbers, I meant count number of statements that could be DCEd. The code currently computes n_ops as it walks the statements that compute the value. So, the idea would be to have another counter next to it, initialized very similarly, except on a statement that !has_single_use it would be reset to zero (essentially not counting that statement or any of its defining statements (transitively)). So it would count solely the statements that could be DCEd.