--- /dev/null
+/* { dg-do run } */
+
+int a, b, c, d, e;
+int f[8];
+static int g() {
+ while (a)
+ a >>= 4;
+ return 0;
+}
+static int h(int i) {
+ if (i >= '0')
+ return i - '0';
+ //__builtin_unreachable ();
+}
+void __attribute__((noipa)) j(int i) {
+ for (b = 2; g() <= 7; b++)
+ if (i) {
+ for (; e <= 7; e++)
+ for (c = 1; c <= 7; c++) {
+ d = h(b + '0');
+ f[-d + 4] ^= 3;
+ }
+ return;
+ }
+}
+int main() {
+ j(1);
+ if (f[2] != 0)
+ __builtin_abort ();
+}
ref = TREE_OPERAND (ref, 0);
}
}
- tree addr = fold_build_pointer_plus (DR_BASE_ADDRESS (dr), off);
+ /* We may not associate the constant offset across the pointer plus
+ expression because that might form a pointer to before the object
+ then. But for some cases we can retain that to allow tree_could_trap_p
+ to return false - see gcc.dg/tree-ssa/predcom-1.c */
+ tree addr, alias_ptr;
+ if (integer_zerop (off))
+ {
+ alias_ptr = fold_convert (reference_alias_ptr_type (ref), coff);
+ addr = DR_BASE_ADDRESS (dr);
+ }
+ else
+ {
+ alias_ptr = build_zero_cst (reference_alias_ptr_type (ref));
+ off = size_binop (PLUS_EXPR, off, coff);
+ addr = fold_build_pointer_plus (DR_BASE_ADDRESS (dr), off);
+ }
addr = force_gimple_operand_1 (unshare_expr (addr), stmts,
is_gimple_mem_ref_addr, NULL_TREE);
- tree alias_ptr = fold_convert (reference_alias_ptr_type (ref), coff);
tree type = build_aligned_type (TREE_TYPE (ref),
get_object_alignment (ref));
ref = build2 (MEM_REF, type, addr, alias_ptr);