+2019-11-06 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ PR tree-optimization/92317
+ * tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard2): Also
+ update phi's with constant phi arguments.
+
2019-11-06 Eric Botcazou <ebotcazou@adacore.com>
Alexandre Oliva <oliva@adacore.com>
+2019-11-06 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ PR tree-optimization/92317
+ * gcc/testsuite/g++.dg/opt/pr92317.C: New test.
+
2019-11-06 Gergö Barany <gergo@codesourcery.com>
Frederik Harwath <frederik@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
--- /dev/null
+// Copied from pr87967.C
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -ftree-vectorize -fno-tree-pre --param vect-epilogues-nomask=1" }
+
+void h();
+template <typename b> struct k { using d = b; };
+template <typename b, template <typename> class> using e = k<b>;
+template <typename b, template <typename> class f>
+using g = typename e<b, f>::d;
+struct l {
+ template <typename i> using ab = typename i::j;
+};
+struct n : l {
+ using j = g<char *, ab>;
+};
+class o {
+public:
+ long r();
+};
+char m;
+char s() {
+ if (m)
+ return '0';
+ return 'A';
+}
+class t {
+public:
+ typedef char *ad;
+ ad m_fn2();
+};
+void fn3() {
+ char *a;
+ t b;
+ bool p = false;
+ while (*a) {
+ h();
+ o c;
+ if (*a)
+ a++;
+ if (c.r()) {
+ n::j q;
+ for (t::ad d = b.m_fn2(), e; d != e; d++) {
+ char f = *q;
+ *d = f + s();
+ }
+ p = true;
+ }
+ }
+ if (p)
+ throw;
+}
{
gphi *update_phi = gsi.phi ();
tree old_arg = PHI_ARG_DEF (update_phi, 0);
- /* This loop-closed-phi actually doesn't represent a use out of the
- loop - the phi arg is a constant. */
- if (TREE_CODE (old_arg) != SSA_NAME)
- continue;
- tree merge_arg = get_current_def (old_arg);
+ tree merge_arg = NULL_TREE;
+
+ /* If the old argument is a SSA_NAME use its current_def. */
+ if (TREE_CODE (old_arg) == SSA_NAME)
+ merge_arg = get_current_def (old_arg);
+ /* If it's a constant or doesn't have a current_def, just use the old
+ argument. */
if (!merge_arg)
merge_arg = old_arg;