aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2022-11-23 19:09:31 +0100
committerJakub Jelinek <jakub@redhat.com>2022-11-23 19:09:31 +0100
commit8a0fce6a51915c29584427fd376b40073c328090 (patch)
tree4598badc17f58607c19570cf8d7703161fcd20da /gcc/c-family
parentc087fe834b19d6c281ce25f729d891bcd14ce404 (diff)
downloadgcc-8a0fce6a51915c29584427fd376b40073c328090.zip
gcc-8a0fce6a51915c29584427fd376b40073c328090.tar.gz
gcc-8a0fce6a51915c29584427fd376b40073c328090.tar.bz2
c: Fix compile time hog in c_genericize [PR107127]
The complex multiplications result in deeply nested set of many SAVE_EXPRs, which takes even on fast machines over 5 minutes to walk. This patch fixes that by using walk_tree_without_duplicates where it is instant. 2022-11-23 Andrew Pinski <apinski@marvell.com> Jakub Jelinek <jakub@redhat.com> PR c/107127 * c-gimplify.cc (c_genericize): Use walk_tree_without_duplicates instead of walk_tree for c_genericize_control_r. * gcc.dg/pr107127.c: New test.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/c-gimplify.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc
index 039a4b9..0034d41 100644
--- a/gcc/c-family/c-gimplify.cc
+++ b/gcc/c-family/c-gimplify.cc
@@ -572,8 +572,8 @@ c_genericize (tree fndecl)
bc_state_t save_state;
push_cfun (DECL_STRUCT_FUNCTION (fndecl));
save_bc_state (&save_state);
- walk_tree (&DECL_SAVED_TREE (fndecl), c_genericize_control_r,
- NULL, NULL);
+ walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
+ c_genericize_control_r, NULL);
restore_bc_state (&save_state);
pop_cfun ();
}