[gcc r11-3747] tree-optimization/97347 - fix another SLP constant insertion issue
Richard Biener
rguenth@gcc.gnu.org
Fri Oct 9 09:28:28 GMT 2020
https://gcc.gnu.org/g:5d708c6315e0fc57992cda7b466a5a9877ced4e3
commit r11-3747-g5d708c6315e0fc57992cda7b466a5a9877ced4e3
Author: Richard Biener <rguenther@suse.de>
Date: Fri Oct 9 10:19:38 2020 +0200
tree-optimization/97347 - fix another SLP constant insertion issue
Just use edge insertion which will appropriately handle the situation
from botan.
2020-10-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/97347
* tree-vect-slp.c (vect_create_constant_vectors): Use
edge insertion when inserting on the fallthru edge,
appropriately insert at the start of BBs when inserting
after PHIs.
* g++.dg/vect/pr97347.cc: New testcase.
Diff:
---
gcc/testsuite/g++.dg/vect/pr97347.cc | 41 ++++++++++++++++++++++++++++++++++++
gcc/tree-vect-slp.c | 19 +++++++++++------
2 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/gcc/testsuite/g++.dg/vect/pr97347.cc b/gcc/testsuite/g++.dg/vect/pr97347.cc
new file mode 100644
index 00000000000..6a9116c412a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr97347.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// { dg-require-effective-target c++11 }
+
+inline namespace __cxx11 {}
+typedef int size_t;
+class MessageAuthenticationCode;
+class __uniq_ptr_impl {
+ struct _Ptr {
+ using type = MessageAuthenticationCode *;
+ };
+public:
+ using pointer = _Ptr::type;
+};
+class unique_ptr {
+public:
+ using pointer = __uniq_ptr_impl::pointer;
+ unique_ptr(pointer);
+};
+namespace __cxx11 {
+class basic_string {
+public:
+ basic_string(char *);
+ ~basic_string();
+};
+} // namespace __cxx11
+class MessageAuthenticationCode {};
+class SCAN_Name {
+public:
+ SCAN_Name(basic_string);
+ size_t arg_as_integer();
+};
+class SipHash : public MessageAuthenticationCode {
+public:
+ SipHash(size_t c, size_t d) : m_C(c), m_D(d) {}
+ size_t m_C, m_D;
+};
+void create(basic_string algo_spec, char *s) {
+ basic_string provider = s;
+ SCAN_Name req(algo_spec);
+ unique_ptr(new SipHash(req.arg_as_integer(), req.arg_as_integer()));
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 77ea4d0eb51..479c3eeaec7 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4145,9 +4145,17 @@ vect_create_constant_vectors (vec_info *vinfo, slp_tree op_node)
{
gimple_stmt_iterator gsi;
if (gimple_code (insert_after->stmt) == GIMPLE_PHI)
- gsi = gsi_after_labels (gimple_bb (insert_after->stmt));
+ {
+ gsi = gsi_after_labels (gimple_bb (insert_after->stmt));
+ gsi_insert_seq_before (&gsi, ctor_seq,
+ GSI_CONTINUE_LINKING);
+ }
else if (!stmt_ends_bb_p (insert_after->stmt))
- gsi = gsi_for_stmt (insert_after->stmt);
+ {
+ gsi = gsi_for_stmt (insert_after->stmt);
+ gsi_insert_seq_after (&gsi, ctor_seq,
+ GSI_CONTINUE_LINKING);
+ }
else
{
/* When we want to insert after a def where the
@@ -4155,11 +4163,10 @@ vect_create_constant_vectors (vec_info *vinfo, slp_tree op_node)
edge. */
edge e = find_fallthru_edge
(gimple_bb (insert_after->stmt)->succs);
- gcc_assert (single_pred_p (e->dest));
- gsi = gsi_after_labels (e->dest);
+ basic_block new_bb
+ = gsi_insert_seq_on_edge_immediate (e, ctor_seq);
+ gcc_assert (!new_bb);
}
- gsi_insert_seq_after (&gsi, ctor_seq,
- GSI_CONTINUE_LINKING);
}
else
vinfo->insert_seq_on_entry (NULL, ctor_seq);
More information about the Gcc-cvs
mailing list