&& !is_runtime_conformable (expr1, expr2);
/* Only analyze the expressions for coarray properties, when in coarray-lib
- mode. */
+ mode. Avoid false-positive uninitialized diagnostics with initializing
+ the codimension flag unconditionally. */
+ lhs_caf_attr.codimension = false;
+ rhs_caf_attr.codimension = false;
if (flag_coarray == GFC_FCOARRAY_LIB)
{
lhs_caf_attr = gfc_caf_attr (expr1, false, &lhs_refs_comp);
&& constraint_expr_equal (a.rhs, b.rhs);
}
-/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 1 "dse1" } } */
-/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 1 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead store: x = " 2 "dse1" } } */
+/* { dg-final { scan-tree-dump-times "Deleted dead store: y = " 2 "dse1" } } */
--- /dev/null
+#include <stdbool.h>
+#include "tree-vect.h"
+
+struct C
+{
+ int c;
+ int d;
+ bool f :1;
+ float e;
+};
+
+struct A
+{
+ unsigned int a;
+ unsigned char c1, c2;
+ bool b1 : 1;
+ bool b2 : 1;
+ bool b3 : 1;
+ struct C b4;
+};
+
+void __attribute__((noipa))
+foo (const struct A * __restrict x, int y)
+{
+ int s = 0, i = 0;
+ for (i = 0; i < y; ++i)
+ {
+ const struct A a = x[i];
+ s += a.b4.f ? 1 : 0;
+ }
+ if (s != 0)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ struct A x[100];
+ int i;
+
+ check_vect ();
+
+ __builtin_memset (x, -1, sizeof (x));
+#pragma GCC novect
+ for (i = 0; i < 100; i++)
+ {
+ x[i].b1 = false;
+ x[i].b2 = false;
+ x[i].b3 = false;
+ x[i].b4.f = false;
+ }
+ foo (x, 100);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target vect_int } } } */
disqualify_candidate (t, reason);
}
+/* Return true if the BIT_FIELD_REF read EXPR is handled by SRA. */
+
+static bool
+sra_handled_bf_read_p (tree expr)
+{
+ uint64_t size, offset;
+ if (bit_field_size (expr).is_constant (&size)
+ && bit_field_offset (expr).is_constant (&offset)
+ && size % BITS_PER_UNIT == 0
+ && offset % BITS_PER_UNIT == 0
+ && pow2p_hwi (size))
+ return true;
+ return false;
+}
+
/* Scan expression EXPR and create access structures for all accesses to
candidates for scalarization. Return the created access or NULL if none is
created. */
struct access *ret = NULL;
bool partial_ref;
- if (TREE_CODE (expr) == BIT_FIELD_REF
+ if ((TREE_CODE (expr) == BIT_FIELD_REF
+ && (write || !sra_handled_bf_read_p (expr)))
|| TREE_CODE (expr) == IMAGPART_EXPR
|| TREE_CODE (expr) == REALPART_EXPR)
{
case COMPONENT_REF:
case ARRAY_REF:
case ARRAY_RANGE_REF:
+ case BIT_FIELD_REF:
ret = create_access (expr, stmt, write);
break;
obstack_grow (&name_obstack, buffer, strlen (buffer));
break;
+ case BIT_FIELD_REF:
case ADDR_EXPR:
make_fancy_name_1 (TREE_OPERAND (expr, 0));
break;
}
break;
- case BIT_FIELD_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
gcc_unreachable (); /* we treat these as scalars. */
tree type, bfr, orig_expr;
bool partial_cplx_access = false;
- if (TREE_CODE (*expr) == BIT_FIELD_REF)
+ if (TREE_CODE (*expr) == BIT_FIELD_REF
+ && (write || !sra_handled_bf_read_p (*expr)))
{
bfr = *expr;
expr = &TREE_OPERAND (*expr, 0);