Comments
Patch
===================================================================
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+
+int i;
+int a[2];
+
+static inline char bar (void)
+{
+ return i ? i : 1;
+}
+
+void foo (int n)
+{
+ while (n--)
+ {
+ a[0] ^= bar ();
+ a[1] ^= bar ();
+ }
+}
+
+static inline char bar1 (void)
+{
+}
+
+void foo1 (int n)
+{
+ while (n--)
+ {
+ a[0] ^= bar1 ();
+ a[1] ^= bar1 ();
+ }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
===================================================================
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+typedef __INT16_TYPE__ int16_t;
+typedef __INT32_TYPE__ int32_t;
+
+static inline int32_t bar (int16_t x, int16_t y)
+{
+ return x * y;
+}
+
+void foo (int16_t i, int16_t *p, int16_t x)
+{
+ while (i--)
+ {
+ *p = bar (*p, x) >> 15;
+ p++;
+ *p = bar (*p, x) >> 15;
+ p++;
+ }
+}
+/* { dg-final { cleanup-tree-dump "vect" } } */
===================================================================
@@ -1902,8 +1902,8 @@ vect_get_constant_vectors (slp_tree slp_
/* For POINTER_PLUS_EXPR we use the type of the constant/invariant
itself.
If OP is the first operand of POINTER_PLUS_EXPR, its type is the type
of
the statement, so it's OK to use OP's type for both first and second
- operands. */
- if (code == POINTER_PLUS_EXPR)
+ operands. We also use the type of OP if it's an invariant variable.
*/
+ if (code == POINTER_PLUS_EXPR || !constant_p)
Hi, With this patch we choose operands' type as the type of the vector created for them in case when the operands are invariant variables. In these PRs we have two different operations, so it doesn't seem appropriate to choose the type according to operation. OK for trunk after bootstrap and testing complete on x86_64-suse-linux? Thanks, Ira ChangeLog: PR tree-optimization/46049 PR tree-optimization/46052 * tree-vect-slp.c (vect_get_constant_vectors): Use operands' type in case of invariant variables. testsuite/ChangeLog: PR tree-optimization/46049 PR tree-optimization/46052 * gcc.dg/vect/pr46052.c: New test. * gcc.dg/vect/pr46049.c: New test. vector_type = get_vectype_for_scalar_type (TREE_TYPE (op)); else vector_type = STMT_VINFO_VECTYPE (stmt_vinfo);