On Mon, 6 Jul 2026, Uros Bizjak wrote: > On Wed, Jul 1, 2026 at 6:07 AM H.J. Lu <[email protected]> wrote: > > > > Revert changes in ix86_find_max_used_stack_alignment > > > > 7b39d7b3b84 Correct x86: Call ix86_access_stack_p only for larger alignment > > c8a84242e4b Update x86: Call ix86_access_stack_p only for larger alignment > > f511bf93f94 x86: Call ix86_access_stack_p only for larger alignment > > a7cce1afee8 x86: Call ix86_access_stack_p only with symbolic constant load > > b54533a2863 x86: Update stack alignment only if stack is used > > b9ea3b2ef98 x86: Properly find the maximum stack slot alignment > > > > Rewrite ix86_find_max_used_stack_alignment based on RTL points-to info > > with find_base_term and static_reg_base_value. If RTL points-to info > > isn't available, > > > > 1. Use ix86_decompose_address to check for symbolic displacement. > > 2. Check MEM_EXPR for incoming parameter reference and non-local reference. > > > > Update the maximum stack slot alignment from memory alignment only if its > > base may point to stack or frame pointers. > > > > Tested on Linux/x86-64. The compile times of PR target/124165 and PR > > target/124684 test are unchanged. > > > > PR target/109780 > > PR target/109093 > > PR target/123210 > > PR target/124098 > > PR target/124165 > > PR target/124684 > > PR target/124759 > > PR target/124789 > > * alias.cc (static_reg_base_value): Moved to rtl.h. > > (find_base_term): Remove static. > > * alias.h (find_base_term): New prototype. > > * function.cc (thread_prologue_and_epilogue_insns): Call > > init_alias_analysis and end_alias_analysis. > > * rtl.h (static_reg_base_value): Moved from alias.cc. > > * config/i386/i386.cc (stack_access_data): Removed. > > (ix86_find_all_reg_uses_1): Likewise. > > (ix86_find_all_reg_uses): Likewise. > > (ix86_access_stack_p): Likewise. > > (ix86_need_alignment_p_2): Likewise. > > (ix86_need_alignment_p_1): Likewise. > > (ix86_need_alignment_p): Likewise. > > (ix86_update_stack_alignment_2): New function. > > (ix86_update_stack_alignment_1): Likewise. > > (ix86_update_stack_alignment): Rewrite. > > (ix86_find_max_used_stack_alignment): If check_stack_slot is > > true, call ix86_update_stack_alignment on each INSN. > > > > Signed-off-by: H.J. Lu <[email protected]> > > Co-Authored-By: Richard Biener <[email protected]> > > I hope that ix86_update_stack_alignment_2 covers all exceptions, so > the patch won't introduce unnecessary stack realignments.
That probably cannot be ruled out, but as we've seen we need to be conservative and points-to analysis is a hard problem, rolling your own in the backend isn't what I'd do. So this would be an opportunity to improve (rewrite) RTL points-to analysis where such code would also get bigger coverage. > OTOH, the > patch now heavily builds on generic RTL analysis, so perhaps a > middle-end person should look if the usage is correct. The patch also > needs separate approval for the changes in generic parts. > > So, LGTM for the x86 part, but please stay around for possible fallout. The middle-end parts are OK. Richard. -- Richard Biener <[email protected]> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Jochen Jaser, Andrew McDonald; (HRB 36809, AG Nuernberg)
