[testcase] New tests for some ccp

Andrew Pinski pinskia@physics.uc.edu
Thu Sep 30 17:47:00 GMT 2004


Two testcases which we optimize at this point but might not after
fixing up the type system unless we actually saw these testcase.

I made these testcases after talking with Diego about what his
current patch would cause and rereading his original posting
about the type system and where he mentioned that
"const gcov_unsigned_t *" and "gcov_unsigned_t *" returns false
at this point for lang_hook.compatible_types_p which in my mind
is wrong because they are compatible types and what they point to
definitely have the same aliasing sets.

OK to commit?

Thanks,
Andrew Pinski


---------------------gcc.dg/tree-ssa/ssa-ccp 
-12.c--------------------------
/* { dg-do link } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
#include <stdbool.h>
#include <strings.h>

static inline bool f(const char *a)
{
   return strcmp (a, "Hello") == 0;
}

void link_error ();

int
main (void)
{
   if (!f ("Hello"))
     link_error ();
}

/* All link_errors should be eliminated. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } } */
---------------------gcc.dg/tree-ssa/ssa-ccp 
-13.c--------------------------
/* { dg-do link } */
/* { dg-options "-O1 -fdump-tree-optimized" } */
#include <stdbool.h>

static inline bool f(const char *a)
{
   return *a == 'H';
}

void link_error ();

int
main (void)
{
   if (!f ("Hello"))
     link_error ();
}

/* All link_errors should be eliminated. */
/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" } } } */



More information about the Gcc-patches mailing list