This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ivopts] Handle type-converted IVs better
Zdenek Dvorak writes:
> you could probably match for something in -fdump-tree-ivopts-details, or
> possibly some pattern (number of additions?) in -fdump-tree-optimized.
I wasn't sure one could match multi-line constructs with tcl but
apparently this works. It should be a good idiom for checking number
of IVs.
As I see Roger has preapproved this so I'll will just check this in
and the original patch tonight.
Adam
* gcc.dg/tree-ssa/ivopts-2.c: New test.
Index: ivopts-2.c
===================================================================
--- ivopts-2.c (revision 0)
+++ ivopts-2.c (revision 0)
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ivopts-details" } */
+
+long last_data_offset;
+int store;
+char *data;
+
+f ()
+{
+
+ long data_offset = last_data_offset;
+ char *p;
+
+ for (p = data; *p; p++)
+ {
+ data_offset++;
+ g (data_offset);
+ store = data_offset + 1;
+ }
+}
+
+/* We should only have two IVs. */
+/* { dg-final { scan-tree-dump-not "\\n candidates .*,.*,.*\\n\[^\\n\]*\\nFinal cost" "ivopts" } } */
+/* { dg-final { cleanup-tree-dump "ivopts" } } */