This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, AARCH64] Enable fuse-caller-save for AARCH64

On 19-06-14 05:53, Richard Henderson wrote:
Do we in fact make sure this isn't an ifunc resolver?  I don't immediately see
how those get wired up in the cgraph...


using the patch below I changed the gcc/testsuite/ testcase to use an ifunc resolver, and observed that the fuse-caller-save optimization didn't work.

The reason the optimization doesn't work in this case is that default_binds_local_p_1 checks the ifunc attribute:
  /* Weakrefs may not bind locally, even though the weakref itself is always
     static and therefore local.  Similarly, the resolver for ifunc functions
     might resolve to a non-local function.
     FIXME: We can resolve the weakref case more curefuly by looking at the
     weakref alias.  */
  else if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp))
	   || (TREE_CODE (exp) == FUNCTION_DECL
	       && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp))))
    local_p = false;

The default_binds_local_p_1 function is used via this path in the optimization:
get_call_reg_set_usage -> get_call_cgraph_rtl_info -> decl_binds_to_current_def_p -> default_binds_local_p -> default_binds_local_p_1 .

- Tom

diff --git a/gcc/testsuite/ b/gcc/testsuite/
index 4ec4995..012dc12 100644
--- a/gcc/testsuite/
+++ b/gcc/testsuite/
@@ -5,11 +5,18 @@
 /* Testing -fuse-caller-save optimization option.  */
 static int __attribute__((noinline))
-bar (int x)
+my_bar (int x)
   return x + 3;
+static void (*resolve_bar (void)) (void)
+  return (void*) my_bar;
+static int __attribute__((noinline)) __attribute__((ifunc ("resolve_bar"))) bar (int x);
 int __attribute__((noinline))
 foo (int y)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]