view gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-8.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */ 
/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre1-stats" } */
struct s {
      int *n;
};

int
foo (__SIZE_TYPE__ i, struct s *array)
{
  int *p = array[i].n;
  if (p)
    {
      int *q = array[i].n;
      if (p != q)
	return 1;
    }
  return 0;
}
/* We should eliminate two address calculations, and one load.  */
/* We also elimiate the PHI node feeding the return because the case
   returning 1 is unreachable.  */
/* We used to eliminate a cast but that was before POINTER_PLUS_EXPR
   was added.  */
/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "fre1"} } */