This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] Testsuite update + new test


gcc.dg/tree-ssa/20030731-2.c is a test for optimizing when PHI nodes
have more than one alternative, but which still create useful equivalences.

For example

PHI node                         Equivalency created
x1 = PHI (x0, x0)                x1 = x0
x1 = PHI (x1, x1, x0, x0)        x1 = x0
x1 = PHI (0, 0)                  x1 = 0
x1 = PHI (x1, x1, 0, 0)          x1 = 0
x1 = PHI (x0, x2)                none


ie if the PHI alternatives are the same (ignoring alternatives which
are the same as the PHI destination), then we can create an equivalence
in the const_and_copies table.

In this particular test doing so allows us to constant propagate away all
uses of the variable "offset".  That in turn makes the first IF conditional
dead.  The test verifies that the IF conditional is removed.

The change to fix this missing optimization is undergoing testing right now.

An earlier change of mine fixes builtins-string-5.c, so we no longer
need to consider it an XFAIL.



	* gcc.dg/tree-ssa/20030731-2.c: New test.
	* gcc.c-torture/execute/builtins/string-5.x: Kill.

Index: gcc.c-torture/execute/builtins/string-5.x
===================================================================
RCS file: gcc.c-torture/execute/builtins/string-5.x
diff -N gcc.c-torture/execute/builtins/string-5.x
*** gcc.c-torture/execute/builtins/string-5.x	3 Jun 2003 16:52:15 -0000	1.1.2.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
***************
*** 1,5 ****
- # We can't replace the call to stpcpy with an inlined memcpy due
- # to limitations in how we gimplify builtins.  Expect execution
- # failures at all optimization levels until we can fix this.
- set torture_execute_xfail [istarget]
- return 0
--- 0 ----
Index: gcc.dg/tree-ssa/20030731-2.c
===================================================================
RCS file: gcc.dg/tree-ssa/20030731-2.c
diff -N gcc.dg/tree-ssa/20030731-2.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc.dg/tree-ssa/20030731-2.c	5 Aug 2003 23:01:09 -0000
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ccp" } */
+   
+ 
+ bar (int i, int partial, int args_addr)
+ {
+   int offset = 0;
+   if (args_addr == 0)
+     offset = 0;
+   if (i >= offset)
+     foo ();
+ }
+ 
+ /* There should be only one IF conditional since the first does nothing
+    useful.  */
+ /* { dg-final { scan-tree-dump-times "if " 1 "ccp"} } */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]