aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2025-04-07 08:03:47 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2025-04-07 08:03:47 +0100
commit30a4eedfdbfeb1caaadd43738cbb0b49d7fa120b (patch)
tree0ded28a83d770f13e76dc339f5e68cac29a25d81
parent4d7a634f6d41029811cdcbd5f7282b5b07890094 (diff)
downloadgcc-30a4eedfdbfeb1caaadd43738cbb0b49d7fa120b.zip
gcc-30a4eedfdbfeb1caaadd43738cbb0b49d7fa120b.tar.gz
gcc-30a4eedfdbfeb1caaadd43738cbb0b49d7fa120b.tar.bz2
combine: Avoid split_i2i3 search if i2 is unchanged [PR116398]
When combining a single-set i2 into a multi-set i3, combine first tries to match the new multi-set in-place. If that fails, combine considers splitting the multi-set so that one set goes in i2 and the other set stays in i3. That moves a destination from i3 to i2 and so combine needs to update any associated log link for that destination to point to i2 rather than i3. However, that kind of split can also occur for 2->2 combinations. For a 2-instruction combination in which i2 doesn't die in i3, combine tries a 2->1 combination by turning i3 into a parallel of the original i2 and the combined i3. If that fails, combine will split the parallel as above, so that the first set goes in i2 and the second set goes in i3. But that can often leave i2 unchanged, meaning that no destinations have moved and so no search is necessary. gcc/ PR testsuite/116398 * combine.cc (try_combine): Shortcut the split_i2i3 handling if i2 is unchanged.
-rw-r--r--gcc/combine.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/combine.cc b/gcc/combine.cc
index 65a87a4..e29cff7 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -4212,6 +4212,12 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
bool only_i3_changed = !i0 && !i1 && rtx_equal_p (newi2pat, PATTERN (i2));
+ /* If only i3 has changed, any split of the combined instruction just
+ restored i2 to its original state. No destinations moved from i3
+ to i2. */
+ if (only_i3_changed)
+ split_i2i3 = false;
+
/* We now know that we can do this combination. Merge the insns and
update the status of registers and LOG_LINKS. */