]> git.ipfire.org Git - thirdparty/gcc.git/commit
ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets
authorManolis Tsamis <manolis.tsamis@vrull.eu>
Fri, 30 Jun 2023 11:06:42 +0000 (13:06 +0200)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Mon, 12 Aug 2024 12:57:21 +0000 (14:57 +0200)
commit28b3812c9d81203ae3d6a5350d8f828f4e659e50
treed6647779834cd89a7b98a40f7f1c77f7cf050428
parent68da681e614c2750f648dac2cd0b2595999ca5d9
ifcvt: handle sequences that clobber flags in noce_convert_multiple_sets

This is an extension of what was done in PR106590.

Currently if a sequence generated in noce_convert_multiple_sets clobbers the
condition rtx (cc_cmp or rev_cc_cmp) then only seq1 is used afterwards
(sequences that emit the comparison itself). Since this applies only from the
next iteration it assumes that the sequences generated (in particular seq2)
doesn't clobber the condition rtx itself before using it in the if_then_else,
which is only true in specific cases (currently only register/subregister moves
are allowed).

This patch changes this so it also tests if seq2 clobbers cc_cmp/rev_cc_cmp in
the current iteration. It also checks whether the resulting sequence clobbers
the condition attached to the jump. This makes it possible to include arithmetic
operations in noce_convert_multiple_sets.

It also makes the code that checks whether the condition is used outside of the
if_then_else emitted more robust.

gcc/ChangeLog:

* ifcvt.cc (check_for_cc_cmp_clobbers): Use modified_in_p instead.
(noce_convert_multiple_sets_1): Don't use seq2 if it clobbers cc_cmp.
Punt if seq clobbers cond. Refactor the code that sets read_comparison.
gcc/ifcvt.cc