diff options
author | Martin Jambor <mjambor@suse.cz> | 2014-04-17 15:53:59 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2014-04-17 15:53:59 +0200 |
commit | 104cb50bd13ccb8ed1934ef3a8f90ec9e4e1c1de (patch) | |
tree | b255138251190ed1adfba46943629741890a091d /gcc/testsuite/gnat.dg | |
parent | b94970bc41f7b2c6ab28d52493f95efcf2fa97de (diff) | |
download | gcc-104cb50bd13ccb8ed1934ef3a8f90ec9e4e1c1de.zip gcc-104cb50bd13ccb8ed1934ef3a8f90ec9e4e1c1de.tar.gz gcc-104cb50bd13ccb8ed1934ef3a8f90ec9e4e1c1de.tar.bz2 |
gimple-iterator.c (gsi_start_edge): New function.
2014-04-17 Martin Jambor <mjambor@suse.cz>
* gimple-iterator.c (gsi_start_edge): New function.
* gimple-iterator.h (gsi_start_edge): Declare.
* tree-sra.c (single_non_eh_succ): New function.
(disqualify_ops_if_throwing_stmt): Renamed to
disqualify_if_bad_bb_terminating_stmt. Allow throwing statements
having one non-EH successor BB.
(sra_modify_expr): If stmt ends bb, use single non-EH successor to
generate loads into replacements.
(sra_modify_assign): Likewise and and also use the simple path for
such statements.
(sra_modify_function_body): Commit statements on edges.
testsuite/
* gnat.dg/opt34.adb: New.
* gnat.dg/opt34_pkg.ads: Likewise.
From-SVN: r209487
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/opt34.adb | 29 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt34_pkg.ads | 14 |
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/opt34.adb b/gcc/testsuite/gnat.dg/opt34.adb new file mode 100644 index 0000000..a5d0ab6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt34.adb @@ -0,0 +1,29 @@ +-- { dg-do compile } +-- { dg-options "-O -fdump-tree-esra" } + +with Opt34_Pkg; use Opt34_Pkg; + +procedure Opt34 is + + function Local_Fun (Arg : T_Private) return T_Private is + Result : T_Private; + begin + + case Get_Integer (Arg) is + when 1 => + Result := Get_Private (100); + when 2 => + Result := T_Private_Zero; + when others => + null; + end case; + + return Result; + end Local_Fun; + +begin + Assert (Get_Integer (Local_Fun (Get_Private (1))) = 100); +end; + +-- { dg-final { scan-tree-dump "Created a replacement for result" "esra" } } +-- { dg-final { cleanup-tree-dump "esra" } } diff --git a/gcc/testsuite/gnat.dg/opt34_pkg.ads b/gcc/testsuite/gnat.dg/opt34_pkg.ads new file mode 100644 index 0000000..83ecb49 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt34_pkg.ads @@ -0,0 +1,14 @@ +package Opt34_Pkg is + + type T_Private is record + I : Integer := 0; + end record; + + T_Private_Zero : constant T_Private := (I => 0); + + function Get_Private (I : Integer) return T_Private; + function Get_Integer (X : T_Private) return Integer; + + procedure Assert (Cond : Boolean); + +end Opt34_Pkg; |