Fix alignment for local variable [PR90811]
authorKito Cheng <kito.cheng@sifive.com>
Tue, 14 Apr 2020 06:53:19 +0000 (14:53 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 20 May 2020 07:17:48 +0000 (15:17 +0800)
commitdfa4fcdba374ed44d4aa1a22b2738f3f5c5b37af
treeafbbdd4decae7fe2579c968b4b242b54f02a67f1
parentb17a002ef579ed85edbe2c241222bfd0a86682db
Fix alignment for local variable [PR90811]

 - The alignment for local variable was adjust during estimate_stack_frame_size,
   however it seems wrong spot to adjust that, expand phase will adjust that
   but it little too late to some gimple optimization, which rely on certain
   target hooks need to check alignment, forwprop is an example for
   that, result of simplify_builtin_call rely on the alignment on some
   target like ARM or RISC-V.

 - Exclude static local var and hard register var in the process of
   alignment adjustment.

 - This patch fix gfortran.dg/pr45636.f90 for arm and riscv.

 - Regression test on riscv32/riscv64 and x86_64-linux-gnu, no new fail
   introduced.

gcc/ChangeLog

PR target/90811
* Makefile.in (OBJS): Add adjust-alignment.o.
* adjust-alignment.c (pass_data_adjust_alignment): New.
(pass_adjust_alignment): New.
(pass_adjust_alignment::execute): New.
(make_pass_adjust_alignment): New.
* tree-pass.h (make_pass_adjust_alignment): New.
* passes.def: Add pass_adjust_alignment.
gcc/ChangeLog
gcc/Makefile.in
gcc/adjust-alignment.c [new file with mode: 0644]
gcc/passes.def
gcc/tree-pass.h