From: Wilco Dijkstra Date: Wed, 21 Jun 2017 10:40:21 +0000 (+0000) Subject: Mark symbols as constant X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f28e54bd06f3733ff147128107a8da6d3e6d428e;p=gcc.git Mark symbols as constant Aarch64_legitimate_constant_p currently returns false for symbols, eventhough they are always valid constants. This means LOSYM isn't CSEd correctly. If we return true CSE works better, resulting in smaller/faster code (0.3% smaller code on SPEC2006). Avoid this for TLS symbols since their sequence is complex. gcc/ * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): Return true for non-tls symbols. From-SVN: r249442 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e08150c612c..1aaaf61a073 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-06-21 Wilco Dijkstra + + * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): + Return true for non-tls symbols. + 2017-06-21 James Greenhalgh * config/aarch64/aarch64-cores.def (cortex-a55): New. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 04417dcd609..ba6b45fcb3d 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10129,6 +10129,11 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx x) && aarch64_valid_symref (XEXP (x, 0), GET_MODE (XEXP (x, 0)))) return true; + /* Treat symbols as constants. Avoid TLS symbols as they are complex, + so spilling them is better than rematerialization. */ + if (SYMBOL_REF_P (x) && !SYMBOL_REF_TLS_MODEL (x)) + return true; + return aarch64_constant_address_p (x); }