new file mode 100644
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-inline -fno-tree-vrp -fno-ipa-sra -fno-tree-dce -fno-tree-ch" } */
+
+int a, c, e, f, g, h[1], i;
+static int j(int b) { return 0; }
+static void k(int d) {}
+int main()
+{
+ if (h[0])
+ while (1) {
+ k(f && j(i && (h[g] = e)));
+ while (a)
+ c ^= 1;
+ }
+ return 0;
+}
@@ -1675,14 +1675,18 @@ virtual_operand_live::get_live_in (basic_block bb)
edge_iterator ei;
edge e;
tree livein = NULL_TREE;
+ bool first = true;
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_DFS_BACK)
/* We can ignore backedges since if there's a def there it would
have forced a PHI in the source because it also acts as use
downstream. */
continue;
- else if (!livein)
- livein = get_live_out (e->src);
+ else if (first)
+ {
+ livein = get_live_out (e->src);
+ first = false;
+ }
else if (get_live_out (e->src) != livein)
/* When there's no virtual use downstream this indicates a point
where we'd insert a PHI merging the different live virtual