https://gcc.gnu.org/g:641ac3403b4f4a6aa706188a17fb36794cb9295c

commit r15-11645-g641ac3403b4f4a6aa706188a17fb36794cb9295c
Author: John David Anglin <[email protected]>
Date:   Sun Oct 4 13:25:13 2026 -0400

    hppa: Fix canonicalize_funcptr_for_compare expander
    
    This fixes the case where the canonicalize_funcptr_for_compare
    expander is called with a SYMBOL_REF that isn't a function
    pointer.  This can happen when one side of the comparison is
    a function pointer and the other side is a data or text symbol.
    
    2026-10-04  John David Anglin  <[email protected]>
    
    gcc/ChangeLog:
    
            * config/pa/pa.md (canonicalize_funcptr_for_compare): Check for
            SYMBOL_REF targets that are not function addresses early and emit
            a direct move instruction to bypass redundant libcall wrappers.

Diff:
---
 gcc/config/pa/pa.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 9bd60e77d028..cd53ce25deda 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -10204,6 +10204,15 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
   "!TARGET_PORTABLE_RUNTIME && !TARGET_64BIT"
   "
 {
+  /* If operand 1 is an address calculation of a variable, do not emit
+     a redundant libcall wrapper.  Copy the address directly.  */
+  if (GET_CODE (operands[1]) == SYMBOL_REF
+      && !SYMBOL_REF_FUNCTION_P (operands[1]))
+    {
+      emit_move_insn (operands[0], operands[1]);
+      DONE;
+    }
+
   if (TARGET_ELF32)
     {
       rtx canonicalize_funcptr_for_compare_libfunc

Reply via email to