]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/aarch64/aarch64.c
Mark symbols as constant
[thirdparty/gcc.git] / gcc / config / aarch64 / aarch64.c
index 04417dcd609f6e8ff594a9c5853b3143696d3208..ba6b45fcb3d5d663dcaf5273a91a7ec03b0618ae 100644 (file)
@@ -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);
 }