https://gcc.gnu.org/g:f567d0df294dd1e5a820f07be91028c712965b6a

commit f567d0df294dd1e5a820f07be91028c712965b6a
Author: Josef Melcr <melcr...@fit.cvut.cz>
Date:   Mon Oct 21 16:31:32 2024 +0200

    omp-cp: fix flags when cloning edges, add lto input and output
    
    gcc/ChangeLog:
    
            * cgraph.cc (cgraph_edge::dump_edge_flags): add callback and
              has_callback printing
            * cgraphclones.cc (cgraph_edge::clone): copy over callback and
              has_callback flags
            * ipa-inline.cc (can_inline_edge_p): move callback condition to
              the beginning
            * lto-cgraph.cc (lto_output_edge): add outputting for callback flags
            (input_edge): add inputting of callback flags
    
    Signed-off-by: Josef Melcr <melcr...@fit.cvut.cz>

Diff:
---
 gcc/cgraph.cc       |  4 ++++
 gcc/cgraphclones.cc |  2 ++
 gcc/ipa-inline.cc   | 10 +++++-----
 gcc/lto-cgraph.cc   |  4 ++++
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 9310f1b43c20..11002c884bb6 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -2114,6 +2114,10 @@ cgraph_edge::dump_edge_flags (FILE *f)
 {
   if (speculative)
     fprintf (f, "(speculative) ");
+  if (callback)
+    fprintf (f, "(callback) ");
+  if (has_callback)
+    fprintf (f, "(has_callback) ");
   if (!inline_failed)
     fprintf (f, "(inlined) ");
   if (call_stmt_cannot_inline_p)
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index 33cab4583348..de57c9bf9ab8 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -144,6 +144,8 @@ cgraph_edge::clone (cgraph_node *n, gcall *call_stmt, 
unsigned stmt_uid,
   new_edge->can_throw_external = can_throw_external;
   new_edge->call_stmt_cannot_inline_p = call_stmt_cannot_inline_p;
   new_edge->speculative = speculative;
+  new_edge->callback = callback;
+  new_edge->has_callback = has_callback;
   new_edge->in_polymorphic_cdtor = in_polymorphic_cdtor;
 
   /* Update IPA profile.  Local profiles need no updating in original.  */
diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc
index b31c028eca2b..a9ed734f8b89 100644
--- a/gcc/ipa-inline.cc
+++ b/gcc/ipa-inline.cc
@@ -371,6 +371,11 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
 {
   gcc_checking_assert (e->inline_failed);
 
+  if(e->callback) {
+    printf("skipping inline - callback\n");
+    return false;
+  }
+
   if (cgraph_inline_failed_type (e->inline_failed) == CIF_FINAL_ERROR)
     {
       if (report)
@@ -453,11 +458,6 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
   if (!inlinable && report)
     report_inline_failed_reason (e);
 
-  if(e->callback) {
-    printf("skipping inline - tried to inline: %d\n", inlinable);
-    inlinable = false;
-  }
-
   return inlinable;
 }
 
diff --git a/gcc/lto-cgraph.cc b/gcc/lto-cgraph.cc
index d1d63fd90ea5..72e6197f5872 100644
--- a/gcc/lto-cgraph.cc
+++ b/gcc/lto-cgraph.cc
@@ -271,6 +271,8 @@ lto_output_edge (struct lto_simple_output_block *ob, struct 
cgraph_edge *edge,
   bp_pack_value (&bp, edge->speculative_id, 16);
   bp_pack_value (&bp, edge->indirect_inlining_edge, 1);
   bp_pack_value (&bp, edge->speculative, 1);
+  bp_pack_value (&bp, edge->callback, 1);
+  bp_pack_value (&bp, edge->has_callback, 1);
   bp_pack_value (&bp, edge->call_stmt_cannot_inline_p, 1);
   gcc_assert (!edge->call_stmt_cannot_inline_p
              || edge->inline_failed != CIF_BODY_NOT_AVAILABLE);
@@ -1538,6 +1540,8 @@ input_edge (class lto_input_block *ib, vec<symtab_node *> 
nodes,
 
   edge->indirect_inlining_edge = bp_unpack_value (&bp, 1);
   edge->speculative = bp_unpack_value (&bp, 1);
+  edge->callback = bp_unpack_value(&bp, 1);
+  edge->has_callback = bp_unpack_value(&bp, 1);
   edge->lto_stmt_uid = stmt_id;
   edge->speculative_id = speculative_id;
   edge->inline_failed = inline_failed;

Reply via email to