* tree-if-conv.c (predicate_mem_writes): Pass true instead of
false to gsi_replace.
* tree-vect-stmts.c (vect_finish_stmt_generation): If stmt
has been in some EH region and vec_stmt could throw, add
vec_stmt into the same EH region.
* tree-data-ref.c (get_references_in_stmt): If IFN_MASK_LOAD
has no lhs, ignore it.
* internal-fn.c (expand_MASK_LOAD): Likewise.
* g++.dg/vect/pr60023.cc: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207464
138bc75d-0d04-0410-961f-
82ee72b054a4
2014-02-04 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/60023
+ * tree-if-conv.c (predicate_mem_writes): Pass true instead of
+ false to gsi_replace.
+ * tree-vect-stmts.c (vect_finish_stmt_generation): If stmt
+ has been in some EH region and vec_stmt could throw, add
+ vec_stmt into the same EH region.
+ * tree-data-ref.c (get_references_in_stmt): If IFN_MASK_LOAD
+ has no lhs, ignore it.
+ * internal-fn.c (expand_MASK_LOAD): Likewise.
+
PR ipa/60026
* tree-inline.c (copy_forbidden): Fail for
__attribute__((optimize (0))) functions.
maskt = gimple_call_arg (stmt, 2);
lhs = gimple_call_lhs (stmt);
+ if (lhs == NULL_TREE)
+ return;
type = TREE_TYPE (lhs);
rhs = fold_build2 (MEM_REF, type, gimple_call_arg (stmt, 0),
gimple_call_arg (stmt, 1));
2014-02-04 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/60023
+ * g++.dg/vect/pr60023.cc: New test.
+
PR ipa/60026
* c-c++-common/torture/pr60026.c: New test.
--- /dev/null
+// PR tree-optimization/60023
+// { dg-do compile }
+// { dg-additional-options "-O3 -std=c++11 -fnon-call-exceptions" }
+// { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } }
+
+struct A { A (); ~A (); };
+
+void
+f1 (int *p, int *q, int *r) noexcept (true)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ if (r[i])
+ p[i] = q[i] + 1;
+}
+
+void
+f2 (int *p, int *q, int *r)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ if (r[i])
+ p[i] = q[i] + 1;
+}
+
+void
+f3 (int *p, int *q) noexcept (true)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ p[i] = q[i] + 1;
+}
+
+void
+f4 (int *p, int *q)
+{
+ int i;
+ for (i = 0; i < 1024; i++)
+ p[i] = q[i] + 1;
+}
+
+void
+f5 (int *p, int *q, int *r) noexcept (true)
+{
+ int i;
+ A a;
+ for (i = 0; i < 1024; i++)
+ if (r[i])
+ p[i] = q[i] + 1;
+}
+
+void
+f6 (int *p, int *q, int *r)
+{
+ int i;
+ A a;
+ for (i = 0; i < 1024; i++)
+ if (r[i])
+ p[i] = q[i] + 1;
+}
+
+void
+f7 (int *p, int *q) noexcept (true)
+{
+ int i;
+ A a;
+ for (i = 0; i < 1024; i++)
+ p[i] = q[i] + 1;
+}
+
+void
+f8 (int *p, int *q)
+{
+ int i;
+ A a;
+ for (i = 0; i < 1024; i++)
+ p[i] = q[i] + 1;
+}
+
+// { dg-final { cleanup-tree-dump "vect" } }
switch (gimple_call_internal_fn (stmt))
{
case IFN_MASK_LOAD:
+ if (gimple_call_lhs (stmt) == NULL_TREE)
+ break;
ref.is_read = true;
case IFN_MASK_STORE:
ref.ref = fold_build2 (MEM_REF,
new_stmt
= gimple_build_call_internal (IFN_MASK_STORE, 4, addr, ptr,
mask, rhs);
- gsi_replace (&gsi, new_stmt, false);
+ gsi_replace (&gsi, new_stmt, true);
}
else if (gimple_vdef (stmt))
{
}
gimple_set_location (vec_stmt, gimple_location (stmt));
+
+ /* While EH edges will generally prevent vectorization, stmt might
+ e.g. be in a must-not-throw region. Ensure newly created stmts
+ that could throw are part of the same region. */
+ int lp_nr = lookup_stmt_eh_lp (stmt);
+ if (lp_nr != 0 && stmt_could_throw_p (vec_stmt))
+ add_stmt_to_eh_lp (vec_stmt, lp_nr);
}
/* Checks if CALL can be vectorized in type VECTYPE. Returns