===================================================================
@@ -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)