Commit 47b840eb by Martin Liska Committed by Martin Liska

Come up with the flag -fipa-stack-alignment.

2018-11-09  Martin Liska  <mliska@suse.cz>

	* common.opt: Add -fipa-stack-alignment flag.
	* doc/invoke.texi: Document it.
	* final.c (rest_of_clean_state): Guard stack
	shrinking with flag.
2018-11-09  Martin Liska  <mliska@suse.cz>

	* gcc.target/i386/ipa-stack-alignment.c: New test.

From-SVN: r265970
parent 2e14744f
2018-11-09 Martin Liska <mliska@suse.cz> 2018-11-09 Martin Liska <mliska@suse.cz>
* common.opt: Add -fipa-stack-alignment flag.
* doc/invoke.texi: Document it.
* final.c (rest_of_clean_state): Guard stack
shrinking with flag.
2018-11-09 Martin Liska <mliska@suse.cz>
* cgraph.h (ipa_discover_readonly_nonaddressable_vars): Rename * cgraph.h (ipa_discover_readonly_nonaddressable_vars): Rename
to ... to ...
(ipa_discover_variable_flags): ... this. (ipa_discover_variable_flags): ... this.
...@@ -1728,6 +1728,10 @@ fipa-reference-addressable ...@@ -1728,6 +1728,10 @@ fipa-reference-addressable
Common Report Var(flag_ipa_reference_addressable) Init(0) Optimization Common Report Var(flag_ipa_reference_addressable) Init(0) Optimization
Discover read-only, write-only and non-addressable static variables. Discover read-only, write-only and non-addressable static variables.
fipa-stack-alignment
Common Report Var(flag_ipa_stack_alignment) Init(1) Optimization
Reduce stack alignment on call sites if possible.
fipa-matrix-reorg fipa-matrix-reorg
Common Ignore Common Ignore
Does nothing. Preserved for backward compatibility. Does nothing. Preserved for backward compatibility.
......
...@@ -414,7 +414,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -414,7 +414,7 @@ Objective-C and Objective-C++ Dialects}.
-finline-small-functions -fipa-cp -fipa-cp-clone @gol -finline-small-functions -fipa-cp -fipa-cp-clone @gol
-fipa-bit-cp -fipa-vrp @gol -fipa-bit-cp -fipa-vrp @gol
-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-reference-addressable @gol -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-reference-addressable @gol
-fipa-icf -fira-algorithm=@var{algorithm} @gol -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
-fira-region=@var{region} -fira-hoist-pressure @gol -fira-region=@var{region} -fira-hoist-pressure @gol
-fira-loop-pressure -fno-ira-share-save-slots @gol -fira-loop-pressure -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots @gol -fno-ira-share-spill-slots @gol
...@@ -8917,6 +8917,11 @@ Enabled by default at @option{-O} and higher. ...@@ -8917,6 +8917,11 @@ Enabled by default at @option{-O} and higher.
Discover read-only, write-only and non-addressable static variables. Discover read-only, write-only and non-addressable static variables.
Enabled by default at @option{-O} and higher. Enabled by default at @option{-O} and higher.
@item -fipa-stack-alignment
@opindex fipa-stack-alignment
Reduce stack alignment on call sites if possible.
Enabled by default.
@item -fipa-pta @item -fipa-pta
@opindex fipa-pta @opindex fipa-pta
Perform interprocedural pointer analysis and interprocedural modification Perform interprocedural pointer analysis and interprocedural modification
...@@ -4890,7 +4890,8 @@ rest_of_clean_state (void) ...@@ -4890,7 +4890,8 @@ rest_of_clean_state (void)
/* We can reduce stack alignment on call site only when we are sure that /* We can reduce stack alignment on call site only when we are sure that
the function body just produced will be actually used in the final the function body just produced will be actually used in the final
executable. */ executable. */
if (decl_binds_to_current_def_p (current_function_decl)) if (flag_ipa_stack_alignment
&& decl_binds_to_current_def_p (current_function_decl))
{ {
unsigned int pref = crtl->preferred_stack_boundary; unsigned int pref = crtl->preferred_stack_boundary;
if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary) if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary)
......
2018-11-09 Martin Liska <mliska@suse.cz> 2018-11-09 Martin Liska <mliska@suse.cz>
* gcc.target/i386/ipa-stack-alignment.c: New test.
2018-11-09 Martin Liska <mliska@suse.cz>
* gcc.dg/tree-ssa/writeonly-2.c: New test. * gcc.dg/tree-ssa/writeonly-2.c: New test.
2018-11-09 Jakub Jelinek <jakub@redhat.com> 2018-11-09 Jakub Jelinek <jakub@redhat.com>
......
/* { dg-do compile } */
/* { dg-options "-fno-ipa-stack-alignment -O" } */
typedef struct {
long a;
long b[];
} c;
c *d;
void e() { d->b[0] = 5; }
void f() { e(); }
/* { dg-final { scan-assembler "sub.*%.sp" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment