]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
target/104327: Allow more inlining between different optimization levels.
authorGeorg-Johann Lay <avr@gjlay.de>
Tue, 23 May 2023 12:54:12 +0000 (14:54 +0200)
committerGeorg-Johann Lay <avr@gjlay.de>
Thu, 25 May 2023 17:42:06 +0000 (19:42 +0200)
avr-common.cc introduces the following options that are set depending
on optimization level: -mgas-isr-prologues, -mmain-is-OS-task and
-fsplit-wide-types-early.  The inliner thinks that different options
disallow cross-optimization inlining, so provide can_inline_p.

gcc/
PR target/104327
* config/avr/avr.cc (avr_can_inline_p): New static function.
(TARGET_CAN_INLINE_P): Define to that function.

gcc/config/avr/avr.cc

index e52f1d81db77676a458bb824c4c78c7bfe1887b1..52aa5c26e1e67bb2de3fe674b2ab5700fb477bb7 100644 (file)
@@ -1019,6 +1019,19 @@ avr_no_gccisr_function_p (tree func)
   return avr_lookup_function_attribute1 (func, "no_gccisr");
 }
 
+
+/* Implement `TARGET_CAN_INLINE_P'.  */
+/* Some options like -mgas_isr_prologues depend on optimization level,
+   and the inliner might think that due to different options, inlining
+   is not permitted; see PR104327.  */
+
+static bool
+avr_can_inline_p (tree /* caller */, tree /* callee */)
+{
+  // No restrictions whatsoever.
+  return true;
+}
+
 /* Implement `TARGET_SET_CURRENT_FUNCTION'.  */
 /* Sanity cheching for above function attributes.  */
 
@@ -14768,6 +14781,9 @@ avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
 #undef  TARGET_MD_ASM_ADJUST
 #define TARGET_MD_ASM_ADJUST avr_md_asm_adjust
 
+#undef  TARGET_CAN_INLINE_P
+#define TARGET_CAN_INLINE_P avr_can_inline_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f