This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[testcase] New tests for some ccp


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" } } } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]