view gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-12.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */ 
/* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
typedef long unsigned int size_t;
union tree_node;
typedef union tree_node *tree;
typedef union gimple_statement_d *gimple;
typedef const union gimple_statement_d *const_gimple;
union gimple_statement_d
{
  unsigned num_ops;
  tree exp;
};

unsigned int x;
static inline tree
gimple_op (const_gimple gs, unsigned i)
{
  if (!(i < gs->num_ops))
    abort ();
  return gs->exp;
}

unsigned char
scan_function (gimple stmt)
{
  unsigned i;
  for (i = 0; i < stmt->num_ops - 3 ; i++)
    gimple_call_arg (stmt, i);
  gimple_op (stmt, 1);
}

/* The test which bypasses the loop is simplified prior to DOM to check
   that stmt->num_ops - 3 != 0.  When that test is false, we can derive
   a value for stmt->num_ops.  That in turn allows us to thread the jump
   for the conditional at the start of the call to gimple_op.  */
/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */