From 361c378dda1f17435ecc364ab246978784df2482 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 19 Oct 2020 11:30:46 +0200 Subject: [PATCH] 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. --- gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c | 27 ++++++++++++++++++++++ gcc/tree-vect-slp.c | 9 ++++++++ 2 files changed, 36 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c 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 ()) -- 2.30.2