re PR rtl-optimization/11557 (constant folding)

PR optimization/11557
	* calls.c (flags_from_decl_or_type): Do not set ECF_LIBCALL_BLOCK
	unless we know which function is being called.

	PR optimization/11557
	* gcc.dg/20030717-1.c: New test.

From-SVN: r69538
This commit is contained in:
Mark Mitchell 2003-07-18 03:05:27 +00:00 committed by Mark Mitchell
parent fea4065dda
commit 2b187c63e2
4 changed files with 39 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2003-07-17 Mark Mitchell <mark@codesourcery.com>
PR optimization/11557
* calls.c (flags_from_decl_or_type): Do not set ECF_LIBCALL_BLOCK
unless we know which function is being called.
2003-07-17 Roger Sayle <roger@eyesopen.com>
* cse.c (fold_rtx): Use swap_commutative_operands_p to determine

View File

@ -730,10 +730,13 @@ flags_from_decl_or_type (tree exp)
if (TREE_NOTHROW (exp))
flags |= ECF_NOTHROW;
if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp))
flags |= ECF_LIBCALL_BLOCK;
}
if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp))
flags |= ECF_CONST | ECF_LIBCALL_BLOCK;
flags |= ECF_CONST;
if (TREE_THIS_VOLATILE (exp))
flags |= ECF_NORETURN;

View File

@ -1,3 +1,8 @@
2003-07-17 Mark Mitchell <mark@codesourcery.com>
PR optimization/11557
* gcc.dg/20030717-1.c: New test.
2003-07-17 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/10476

View File

@ -0,0 +1,24 @@
/* { dg-do run } */
/* { dg-options "-O2" } */
extern void abort (void);
int zero (void)
{
return 0;
}
int one (void)
{
return 1;
}
int main (void)
{
int i = 1;
int r = (i ? one : zero)();
if (r != 1)
abort();
return 0;
}