Fix canonicalize_funcptr_for_compare for non-function SYMBOL_REFs
Ensures function pointer comparison handles non-function symbols correctly.
This commit corrects the canonicalize_funcptr_for_compare expander on the HPPA architecture. Previously, it could fail when comparing a function pointer with a SYMBOL_REF that did not represent a function address (e.g., a data or text symbol). The fix ensures that such cases are handled directly, emitting a move instruction to bypass unnecessary libcall wrappers and preventing potential issues.
In Details
The HPPA canonicalize_funcptr_for_compare expander incorrectly handled SYMBOL_REFs that were not function pointers. This commit modifies the expander to check for non-function SYMBOL_REF targets early, emitting a direct move instruction to bypass libcall wrappers and ensuring correct comparison behavior when one side is a function pointer and the other is not.
- Expander
- A piece of code within GCC that translates a high-level RTL construct into a sequence of specific machine instructions.
- SYMBOL_REF
- An internal GCC representation for a reference to a symbol, which can be a variable, function, or other named entity.
- libcall
- A call to a function within a standard library. In this context, it refers to potentially inefficient wrappers generated for certain operations.
- HPPA
- Hewlett-Packard Precision Architecture, a RISC instruction set architecture.