From: Richard Biener Date: Mon, 19 Oct 2020 09:30:46 +0000 (+0200) Subject: tree-optimization/97486 - avoid edge insertion in SLP vectorizing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=361c378dda1f17435ecc364ab246978784df2482;p=gcc.git tree-optimization/97486 - avoid edge insertion in SLP vectorizing This avoids edge inserting and eventual splitting during BB SLP vectorization for now. 2020-10-19 Richard Biener PR tree-optimization/97486 * tree-vect-slp.c (vect_slp_function): Split after stmts ending a BB. * gcc.dg/vect/bb-slp-pr97486.c: New testcase. --- diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c new file mode 100644 index 00000000000..17d48a7fe69 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +struct { + int *end_info; + int *fp; +} png_load_body_c; + +int *png_set_longjmp_fn(); + +void setjmp(); + +void png_load_body() +{ + int *fp; + int png_ptr, info_ptr, *end_info; + if (!fp) + return; + if (png_ptr) { + info_ptr = 0; + end_info = png_set_longjmp_fn(); + } + png_load_body_c.end_info = end_info; + png_load_body_c.fp = fp; + if (png_ptr) + png_set_longjmp_fn(); + setjmp(info_ptr); +} diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index a2fbbc56bcc..f36d8d1c642 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -4214,6 +4214,15 @@ vect_slp_function (function *fun) } else bbs.safe_push (bb); + + /* When we have a stmt ending this block we have to insert on + edges when inserting after it. Avoid this for now. */ + if (gimple *last = last_stmt (bb)) + if (is_ctrl_altering_stmt (last)) + { + r |= vect_slp_bbs (bbs); + bbs.truncate (0); + } } if (!bbs.is_empty ())