]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy assignment...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 23 Sep 2013 16:07:19 +0000 (16:07 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 23 Sep 2013 16:07:19 +0000 (16:07 +0000)
* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy
assignment statements.

From-SVN: r202833

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/opt28.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt28.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt28_pkg.ads [new file with mode: 0644]
gcc/tree-ssa-ccp.c

index 026a560fff07e7de8276cce6655fdf0bc06e38d5..a77d7c7670f12d35a3e4421e3116e62b1bda1932 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy
+       assignment statements.
+
 2013-09-23  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        * gimple-pretty-print.c (dump_ssaname_info): New function.
index bd6998f77a7c5272418b7b8ff1d321bde884459d..8a197107f86016c49e5aec0941e5e026e618e45e 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/opt28.ad[sb]: New test.
+       * gnat.dg/opt28_pkg.ads: New helper.
+
 2013-09-23  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/58464
 
 2013-09-18  Eric Botcazou  <ebotcazou@adacore.com>
 
-       *  gnat.dg/array_bounds_test2.adb: New test.
+       * gnat.dg/array_bounds_test2.adb: New test.
 
 2013-09-18  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
diff --git a/gcc/testsuite/gnat.dg/opt28.adb b/gcc/testsuite/gnat.dg/opt28.adb
new file mode 100644 (file)
index 0000000..74a4c5c
--- /dev/null
@@ -0,0 +1,31 @@
+with Opt28_Pkg; use Opt28_Pkg;
+
+package body Opt28 is
+
+  function Full_Filename (Filename : String) return String is
+    Path : constant String := "PATH";
+    Posix_Path : constant Posix_String := To_Posix (Path);
+  begin
+
+    declare
+      M : constant Posix_String := Value_Of (Posix_Path);
+      N : constant Posix_String (1 .. M'Length) := M;
+      Var : constant String := To_String (Str => N);
+      Start_Pos : Natural := 1;
+      End_Pos   : Natural := 1;
+    begin
+      while Start_Pos <= Var'Length loop
+        End_Pos := Position (Var (Start_Pos .. Var'Length));
+
+        if Is_File (To_Posix (Var (Start_Pos .. End_Pos - 1) & Filename)) then
+          return Var (Start_Pos .. End_Pos - 1) & Filename;
+        else
+          Start_Pos := End_Pos + 1;
+        end if;
+      end loop;
+    end;
+
+    return "";
+  end;
+
+end Opt28;
diff --git a/gcc/testsuite/gnat.dg/opt28.ads b/gcc/testsuite/gnat.dg/opt28.ads
new file mode 100644 (file)
index 0000000..4887c21
--- /dev/null
@@ -0,0 +1,8 @@
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+package Opt28 is
+
+  function Full_Filename (Filename : String) return String;
+
+end Opt28;
diff --git a/gcc/testsuite/gnat.dg/opt28_pkg.ads b/gcc/testsuite/gnat.dg/opt28_pkg.ads
new file mode 100644 (file)
index 0000000..c3c32fe
--- /dev/null
@@ -0,0 +1,11 @@
+package Opt28_Pkg is
+
+  type Posix_String is array (Positive range <>) of aliased Character;
+
+  function To_Posix (Str : String) return Posix_String;
+  function To_String (Str : Posix_String) return String;
+  function Is_File (Str : Posix_String) return Boolean;
+  function Value_Of (Name : Posix_String) return Posix_String;
+  function Position (In_Line : String) return Natural;
+
+end Opt28_Pkg;
index ea1269c53cdeb0b2e4532c72fc475976cfd24d1d..1f044063bb61435a4e5d5fb348843881ac28df89 100644 (file)
@@ -1728,6 +1728,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
        insert_clobber_before_stack_restore (gimple_phi_result (stmt), var,
                                             visited);
       }
+    else if (gimple_assign_ssa_name_copy_p (stmt))
+      insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
+                                          visited);
     else
       gcc_assert (is_gimple_debug (stmt));
 }