aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/calls.c15
-rw-r--r--gcc/config/aarch64/aarch64.md15
3 files changed, 20 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cee39a1..40537cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2016-08-09 Renlin Li <renlin.li@arm.com>
+
+ PR middle-end/64971
+ * calls.c (prepare_call_address): Convert funexp to Pmode when
+ necessary.
+ * config/aarch64/aarch64.md (sibcall): Remove fix for PR 64971.
+ (sibcall_value): Likewise.
+
2016-08-09 Marek Polacek <polacek@redhat.com>
PR c/7652
diff --git a/gcc/calls.c b/gcc/calls.c
index 949a92e..4ad3e34 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -194,10 +194,19 @@ prepare_call_address (tree fndecl_or_type, rtx funexp, rtx static_chain_value,
&& targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
? force_not_mem (memory_address (FUNCTION_MODE, funexp))
: memory_address (FUNCTION_MODE, funexp));
- else if (! sibcallp)
+ else
{
- if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse)
- funexp = force_reg (Pmode, funexp);
+ /* funexp could be a SYMBOL_REF represents a function pointer which is
+ of ptr_mode. In this case, it should be converted into address mode
+ to be a valid address for memory rtx pattern. See PR 64971. */
+ if (GET_MODE (funexp) != Pmode)
+ funexp = convert_memory_address (Pmode, funexp);
+
+ if (! sibcallp)
+ {
+ if (!NO_FUNCTION_CSE && optimize && ! flag_no_function_cse)
+ funexp = force_reg (Pmode, funexp);
+ }
}
if (static_chain_value != 0
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index f15dd8d..c95258b 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -859,13 +859,6 @@
|| aarch64_is_noplt_call_p (callee)))
XEXP (operands[0], 0) = force_reg (Pmode, callee);
- /* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr
- is generating an SImode symbol reference. See PR 64971. */
- if (TARGET_ILP32
- && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
- && GET_MODE (XEXP (operands[0], 0)) == SImode)
- XEXP (operands[0], 0) = convert_memory_address (Pmode,
- XEXP (operands[0], 0));
if (operands[2] == NULL_RTX)
operands[2] = const0_rtx;
@@ -897,14 +890,6 @@
|| aarch64_is_noplt_call_p (callee)))
XEXP (operands[1], 0) = force_reg (Pmode, callee);
- /* FIXME: This is a band-aid. Need to analyze why expand_expr_addr_expr
- is generating an SImode symbol reference. See PR 64971. */
- if (TARGET_ILP32
- && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
- && GET_MODE (XEXP (operands[1], 0)) == SImode)
- XEXP (operands[1], 0) = convert_memory_address (Pmode,
- XEXP (operands[1], 0));
-
if (operands[3] == NULL_RTX)
operands[3] = const0_rtx;