Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > On 12/27/22 16:11, juzhe.zhong wrote: >> You mean only change to this form you suggested in this patch? Since in >> all other places of this PASS,I use RTL_SSA framework to iterate >> instructions and blocks. I use RTL_SSA framework to iterate blocks here >> to make codes look more consistent even though they are same here. > The FOR_EACH_BB is used far more widely than the C++ style found in > RTL-SSA so I'd slightly prefer that style.
I can see where you're coming from, but what the patch does is preferred for RTL-SSA passes. There is some additional information in rtl_ssa::bb_info compared to the underlying basic_block, and even if this particular loop doesn't use that information, IMO it would be better to avoid mixing styles within a pass. Also, the list that the patch iterates over is in reverse postorder, whereas FOR_EACH_BB doesn't guarantee a particular order. Again, that might not be important here, but it seems better to stick to the “native” RTL-SSA approach. Thanks, Richard