[gcc r17-3555] compare-elim: Test the successor's live-in set for the flags register
Kyrylo Tkachov via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:6ddf635c9c694dcdf5a5e490592f71b65c7e278f commit r17-3555-g6ddf635c9c694dcdf5a5e490592f71b65c7e278f Author: Kyrylo Tkachov <[email protected]> Date: Thu Jul 30 12:12:00 2026 +0200 compare-elim: Test the successor's live-in set for the flags register find_comparisons_in_bb looks for a flags value that is live out of BB and live into a successor that is not part of the extended basic block. The edge walk computes DEST but then queries the live-in set of BB rather than of DEST, so the answer says nothing about the successor being examined. The pass can therefore leave missing_uses clear for a comparison whose flags really are used in a join block. The test read DF_LIVE_BB_INFO (dest)->in when the pass was added in r169131. r179749 mechanically converted the accessors and changed DEST to BB at the same time. Restore the original test. The condition is only reachable when the flags register is live across a basic block boundary, which is why this has gone unnoticed. Bootstrapped and tested on aarch64-none-linux-gnu. gcc/ChangeLog: * compare-elim.cc (find_comparisons_in_bb): Test the live-in set of the successor block rather than of the current block. Signed-off-by: Kyrylo Tkachov <[email protected]> Diff: --- gcc/compare-elim.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/compare-elim.cc b/gcc/compare-elim.cc index 723f9e31c791..6218324e1ab6 100644 --- a/gcc/compare-elim.cc +++ b/gcc/compare-elim.cc @@ -465,7 +465,7 @@ find_comparison_dom_walker::before_dom_children (basic_block bb) FOR_EACH_EDGE (e, ei, bb->succs) { basic_block dest = e->dest; - if (bitmap_bit_p (df_get_live_in (bb), targetm.flags_regnum) + if (bitmap_bit_p (df_get_live_in (dest), targetm.flags_regnum) && !single_pred_p (dest)) { last_cmp->missing_uses = true;