View | Details | Return to bug 61515
Collapse All | Expand All

(-)gcc/tree-ssa-threadedge.c (-17 / +30 lines)
Lines 287-306 fold_assignment_stmt (gimple stmt) Link Here
287
    }
287
    }
288
}
288
}
289
289
290
/* A new value has been assigned to LHS.  If necessary, invalidate any
291
   equivalences that are no longer valid.  */
292
static void
293
invalidate_equivalences (tree lhs, vec<tree> *stack)
294
{
295
296
  for (unsigned int i = 1; i < num_ssa_names; i++)
297
    if (ssa_name (i) && SSA_NAME_VALUE (ssa_name (i)) == lhs)
298
      record_temporary_equivalence (ssa_name (i), NULL_TREE, stack);
299
300
  if (SSA_NAME_VALUE (lhs))
301
    record_temporary_equivalence (lhs, NULL_TREE, stack);
302
}
303
304
/* Try to simplify each statement in E->dest, ultimately leading to
290
/* Try to simplify each statement in E->dest, ultimately leading to
305
   a simplification of the COND_EXPR at the end of E->dest.
291
   a simplification of the COND_EXPR at the end of E->dest.
306
292
Lines 335-340 record_temporary_equivalences_from_stmts Link Here
335
     we discover.  Note any equivalences we discover are context
321
     we discover.  Note any equivalences we discover are context
336
     sensitive (ie, are dependent on traversing E) and must be unwound
322
     sensitive (ie, are dependent on traversing E) and must be unwound
337
     when we're finished processing E.  */
323
     when we're finished processing E.  */
324
  bitmap to_invalidate = BITMAP_ALLOC (NULL);
338
  for (gsi = gsi_start_bb (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
325
  for (gsi = gsi_start_bb (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
339
    {
326
    {
340
      tree cached_lhs = NULL;
327
      tree cached_lhs = NULL;
Lines 379-385 record_temporary_equivalences_from_stmts Link Here
379
366
380
	  if (backedge_seen)
367
	  if (backedge_seen)
381
	    FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
368
	    FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
382
	      invalidate_equivalences (op, stack);
369
	      bitmap_set_bit (to_invalidate, SSA_NAME_VERSION (op));
383
370
384
	  continue;
371
	  continue;
385
	}
372
	}
Lines 419-425 record_temporary_equivalences_from_stmts Link Here
419
	      if (backedge_seen)
406
	      if (backedge_seen)
420
		{
407
		{
421
		  tree lhs = gimple_get_lhs (stmt);
408
		  tree lhs = gimple_get_lhs (stmt);
422
		  invalidate_equivalences (lhs, stack);
409
		  bitmap_set_bit (to_invalidate, SSA_NAME_VERSION (lhs));
423
		}
410
		}
424
	      continue;
411
	      continue;
425
	    }
412
	    }
Lines 497-504 record_temporary_equivalences_from_stmts Link Here
497
	      || is_gimple_min_invariant (cached_lhs)))
484
	      || is_gimple_min_invariant (cached_lhs)))
498
	record_temporary_equivalence (gimple_get_lhs (stmt), cached_lhs, stack);
485
	record_temporary_equivalence (gimple_get_lhs (stmt), cached_lhs, stack);
499
      else if (backedge_seen)
486
      else if (backedge_seen)
500
	invalidate_equivalences (gimple_get_lhs (stmt), stack);
487
	bitmap_set_bit (to_invalidate,
488
			SSA_NAME_VERSION (gimple_get_lhs (stmt)));
489
    }
490
491
  /* Now invalidate all equivalencies we have to invalidate.  */
492
  for (unsigned int i = 1; i < num_ssa_names; ++i)
493
    {
494
      tree name = ssa_name (i);
495
      if (!name)
496
	continue;
497
498
      tree val = SSA_NAME_VALUE (name);
499
      if (val
500
	  && TREE_CODE (val) == SSA_NAME
501
	  && bitmap_bit_p (to_invalidate, SSA_NAME_VERSION (val)))
502
	record_temporary_equivalence (name, NULL_TREE, stack);
501
    }
503
    }
504
  unsigned i;
505
  bitmap_iterator bi;
506
  EXECUTE_IF_SET_IN_BITMAP (to_invalidate, 0, i, bi)
507
    {
508
      tree name = ssa_name (i);
509
      if (SSA_NAME_VALUE (name))
510
	record_temporary_equivalence (name, NULL_TREE, stack);
511
    }
512
513
  BITMAP_FREE (to_invalidate);
514
502
  return stmt;
515
  return stmt;
503
}
516
}
504
517

Return to bug 61515