https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104581
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, you're right. So, can't it instead of the quadratic walk just compare DF_INSN_LUID? If it isn't right after df_analyze and some insns could have been added in between, it would need to maintain the luids somehow (perhaps e.g. in the way how we do it in tree-ssa-reassoc.cc, if we add insns, we must set their uid to either the previous or next insn's uid and then can do some IL walk, but only as long as the uid is the same, so unless everything in the bb changes it should be still cheap.