This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make bsi_after_labels return a BSI pointing after the labels (4.1 too?)


Right now, bsi_after_labels returns a BSI pointing to the last label, so that inserting with bsi_insert_after inserts a statement at the beginning of the block.

Originally bsi_after_labels aborted if the block had no labels, because then a bsi_insert_after would insert a statement as *second* and not *first*. This changed with the patch PR23625, but it still can cause ice-on-valid errors with checking enabled (in case the second statement defines an SSA_NAME used in the first) and wrong-code errors with checking disabled. I don't have a testcase on unpatched mainline, but it happened in a pass I'm not contributing to FSF GCC.

The solution is to make bsi_after_labels do what it's supposed to do, and change the users to use bsi_insert_before. Only one user turned out to be a bit problematic, because we have to contextually change BSI_NEW_STMT to BSI_SAME_STMT, and scev_const_prop wants to call force_gimple_operand_bsi and pass a bsi for the newly inserted statement. I fixed this by working on a copy of the BSI.

Bootstrapped/regtested i686-pc-linux-gnu, all languages. Ok for mainline, and maybe for 4.1 after a week or less?

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]