]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-cp: Fix ipa-bit-cp test for recipient_only lattices
authorMartin Jambor <mjambor@suse.cz>
Mon, 12 Jan 2026 12:32:06 +0000 (13:32 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 12 Jan 2026 12:32:09 +0000 (13:32 +0100)
Unfortunately I made a silly copy-and paste error in may patch
introducing the recipient_only flag.  This patch fixes it, correctly
bailing out in ipa-bit-cp when it is set during propagation.

gcc/ChangeLog:

2026-01-12  Martin Jambor  <mjambor@suse.cz>

PR ipa/123543
* ipa-cp.cc (propagate_bits_across_jump_function): Fix test for
recipient_only_p.

gcc/testsuite/ChangeLog:

2026-01-12  Martin Jambor  <mjambor@suse.cz>

PR ipa/123543
* gcc.dg/ipa/pr123543.c: New test.

gcc/ipa-cp.cc
gcc/testsuite/gcc.dg/ipa/pr123543.c [new file with mode: 0644]

index 54f4e4f543c2ec323f032d6ed17dfafdd18d6b12..9f61f682d58ea9fbef1c7e29c8fc1578a56d80c7 100644 (file)
@@ -2618,7 +2618,7 @@ propagate_bits_across_jump_function (cgraph_edge *cs, int idx,
         and we store it in jump function during analysis stage.  */
 
       if (!src_lats->bits_lattice.bottom_p ()
-         || src_lats->bits_lattice.recipient_only_p ())
+         && !src_lats->bits_lattice.recipient_only_p ())
        {
          if (!op_type)
            op_type = ipa_get_type (caller_info, src_idx);
diff --git a/gcc/testsuite/gcc.dg/ipa/pr123543.c b/gcc/testsuite/gcc.dg/ipa/pr123543.c
new file mode 100644 (file)
index 0000000..b3cd4c2
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-O3" } */
+
+__attribute__((noinline))
+static int local_f(int a, int b) { return a + b; }
+
+__attribute__((noinline))
+int extern_f(int a, int b) { return local_f(a, b); }
+
+int  unused_g1(int b) { return extern_f(0, b); }
+
+int (*volatile fp)(int, int) = extern_f;
+
+int main() { if (fp(1, 2) != 3) __builtin_abort(); }