===================================================================
@@ -12180,8 +12180,9 @@ sparc_frame_pointer_required (void)
if (TARGET_FLAT)
return false;
- /* Otherwise, the frame pointer is required if the function isn't leaf. */
- return !(crtl->is_leaf && only_leaf_regs_used ());
+ /* Otherwise, the frame pointer is required if the function isn't leaf, but
+ we cannot use sparc_leaf_function_p since it hasn't been computed yet. */
+ return !(optimize > 0 && crtl->is_leaf && only_leaf_regs_used ());
}
/* The way this is structured, we can't eliminate SFP in favor of SP