This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Speedup DOM and tree-cfg a lot (partial of PR 15524)
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Tue, 18 May 2004 19:11:11 -0400
- Subject: [PATCH] Speedup DOM and tree-cfg a lot (partial of PR 15524)
I noticed this when I was looking into why GCC was failing to bootstrap
on OpenBSD 3.1 because of memory hog, and I noticed that something was
changed in the middle-end to speed up cases with large amount of switch
statements. I looked into that PR and decided to test the testcase and
I noticed it was slow so I decided to file a bug and see if there was
any easy thing to fix. I noticed that find_case_label_for_value was
calling simple_cst_equal on CASE_LOW which is not needed, only a
call to tree_int_cst_compare is needed as CASE_LOW is only ever
an INTEGER_CST as defined by c-tree.texi.
This patch changes the call to simple_cst_equal to be
tree_int_cst_compare
to get a speedup (I did not test how much though), it should also speed
up bootstrap of gcc as there are some large switch statements in
insn-attrtab.c.
OK? Bootstrapped on powerpc-apple-darwin with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* tree-cfg.c (find_case_label_for_value): Replace call to
simple_cst_equal with tree_int_cst_compare.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.2
diff -u -p -r2.2 tree-cfg.c
--- tree-cfg.c 15 May 2004 23:07:51 -0000 2.2
+++ tree-cfg.c 18 May 2004 22:25:34 -0000
@@ -1958,7 +1958,7 @@ find_case_label_for_value (tree switch_e
else if (CASE_HIGH (t) == NULL)
{
/* A `normal' case label. */
- if (simple_cst_equal (CASE_LOW (t), val) == 1)
+ if (tree_int_cst_compare (CASE_LOW (t), val) == 0)
return t;
}
else