aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2025-08-21 16:16:02 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2025-08-21 16:16:02 +0100
commit0d34e73b71ce199f52de227c4101256484feaa78 (patch)
tree25c955d69b0555383070cbb68c73f5d1db742292 /gcc/testsuite
parentfb7c62f7a8fed8e30c5bd6cbb0fdb26774ba247d (diff)
downloadgcc-0d34e73b71ce199f52de227c4101256484feaa78.zip
gcc-0d34e73b71ce199f52de227c4101256484feaa78.tar.gz
gcc-0d34e73b71ce199f52de227c4101256484feaa78.tar.bz2
rtl-ssa: Add missing live-out uses [PR121619]
This PR is another bug in the rtl-ssa code to manage live-out uses. It seems that this didn't get much coverage until recently. In the testcase, late-combine first removed a register-to-register move by substituting into all uses, some of which were in other EBBs. This was done after checking make_uses_available, which (as expected) says that single dominating definitions are available everywhere that the definition dominates. But the update failed to add appropriate live-out uses, so a later parallelisation attempt tried to move the new destination into a later block. gcc/ PR rtl-optimization/121619 * rtl-ssa/functions.h (function_info::commit_make_use_available): Declare. * rtl-ssa/blocks.cc (function_info::commit_make_use_available): New function. * rtl-ssa/changes.cc (function_info::apply_changes_to_insn): Use it. gcc/testsuite/ PR rtl-optimization/121619 * gcc.dg/pr121619.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/pr121619.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr121619.c b/gcc/testsuite/gcc.dg/pr121619.c
new file mode 100644
index 0000000..a63896d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr121619.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fno-gcse -fno-tree-ter -fno-guess-branch-probability -fno-forward-propagate" } */
+
+int printf(const char *, ...);
+long a, c, d;
+char b;
+int main() {
+f : {
+ short g = 100;
+ int h = 1;
+ while (1) {
+ char i = 0;
+ if (a)
+ i = h = -b;
+ short j = g;
+ c = h ^ g;
+ g = ~(-h / c + 1);
+ if (b > 6) {
+ a = g && -1;
+ goto f;
+ }
+ if (j < 100)
+ printf("%ld\n", d);
+ if (g - 1)
+ break;
+ b = i;
+ }
+ int k = 2L % g;
+ if (k)
+ goto f;
+ }
+ return 0;
+}