If there is a LOG_LINK between two insns, this means those two insns can be combined, as far as dataflow is concerned. There never should be a LOG_LINK between two unrelated insns. If there is one, combine will try to combine the insns without doing all the needed checks if the earlier destination is used before the later insn, etc.
Unfortunately we do not update the LOG_LINKs correctly in some cases. This patch fixes at least some of those cases.
- combine.c (try_combine): New variable split_i2i3. Set it to true if we generated a parallel as new i3 and we split that to new i2 and i3 instructions. Handle split_i2i3 similar to swap_i2i3: scan the LOG_LINKs of i3 to see which of those need to link to i2 now. Link those to i2, not i1. Partially rewrite this scan code.
gcc/testsuite/ PR rtl-optimization/84169
- gcc.c-torture/execute/pr84169.c: New.
96eca8f4233 combine: Update links correctly for new I2 (PR84169)
gcc/ChangeLog | 9 +++++
gcc/combine.c | 57 +++++++++++++++------------
gcc/testsuite/ChangeLog | 5 +++
gcc/testsuite/gcc.c-torture/execute/pr84169.c | 25 ++++++++++++
4 files changed, 70 insertions(+), 26 deletions(-)