This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][mem-ref2] More merge glitches
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 20 May 2010 17:55:47 +0200 (CEST)
- Subject: [PATCH][mem-ref2] More merge glitches
A few more merge glitches.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
branch.
Richard.
2010-05-20 Richard Guenther <rguenther@suse.de>
* cgraphbuild.c (mark_load): Properly check for NULL result
from get_base_address.
(mark_store): Likewise.
* tree-pretty-print.c (print_call_name): Handle MEM_REF.
* tree-ssa-structalias.c (find_func_clobbers): Likewise.
* gimple.h (gimple_call_fndecl): Likewise.
Index: gcc/cgraphbuild.c
===================================================================
*** gcc/cgraphbuild.c (revision 159563)
--- gcc/cgraphbuild.c (working copy)
*************** mark_load (gimple stmt ATTRIBUTE_UNUSED,
*** 275,281 ****
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
! if (TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
--- 275,281 ----
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
! if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
*************** mark_store (gimple stmt ATTRIBUTE_UNUSED
*** 300,306 ****
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
! if (TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
--- 300,306 ----
void *data ATTRIBUTE_UNUSED)
{
t = get_base_address (t);
! if (t && TREE_CODE (t) == VAR_DECL
&& (TREE_STATIC (t) || DECL_EXTERNAL (t)))
{
struct varpool_node *vnode = varpool_node (t);
Index: gcc/tree-pretty-print.c
===================================================================
*** gcc/tree-pretty-print.c (revision 159559)
--- gcc/tree-pretty-print.c (working copy)
*************** print_call_name (pretty_printer *buffer,
*** 2780,2785 ****
--- 2780,2792 ----
dump_generic_node (buffer, op0, 0, flags, false);
break;
+ case MEM_REF:
+ if (integer_zerop (TREE_OPERAND (op0, 1)))
+ {
+ op0 = TREE_OPERAND (op0, 0);
+ goto again;
+ }
+ /* Fallthru. */
case COMPONENT_REF:
case SSA_NAME:
case OBJ_TYPE_REF:
Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c (revision 159563)
--- gcc/tree-ssa-structalias.c (working copy)
*************** find_func_clobbers (gimple origt)
*** 4566,4572 ****
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
! || INDIRECT_REF_P (tem))
{
struct constraint_expr lhsc, *rhsp;
unsigned i;
--- 4566,4576 ----
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
! || INDIRECT_REF_P (tem)
! || (TREE_CODE (tem) == MEM_REF
! && !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
! && auto_var_in_fn_p
! (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
{
struct constraint_expr lhsc, *rhsp;
unsigned i;
*************** find_func_clobbers (gimple origt)
*** 4590,4596 ****
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
! || INDIRECT_REF_P (tem))
{
struct constraint_expr lhs, *rhsp;
unsigned i;
--- 4594,4604 ----
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
&& !auto_var_in_fn_p (tem, cfun->decl))
! || INDIRECT_REF_P (tem)
! || (TREE_CODE (tem) == MEM_REF
! && !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
! && auto_var_in_fn_p
! (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
{
struct constraint_expr lhs, *rhsp;
unsigned i;
Index: gcc/gimple.h
===================================================================
*** gcc/gimple.h (revision 159563)
--- gcc/gimple.h (working copy)
*************** gimple_call_fndecl (const_gimple gs)
*** 1975,1981 ****
{
tree addr = gimple_call_fn (gs);
if (TREE_CODE (addr) == ADDR_EXPR)
! return TREE_OPERAND (addr, 0);
return NULL_TREE;
}
--- 1975,1992 ----
{
tree addr = gimple_call_fn (gs);
if (TREE_CODE (addr) == ADDR_EXPR)
! {
! tree fndecl = TREE_OPERAND (addr, 0);
! if (TREE_CODE (fndecl) == MEM_REF)
! {
! if (TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
! && integer_zerop (TREE_OPERAND (fndecl, 1)))
! return TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
! else
! return NULL_TREE;
! }
! return TREE_OPERAND (addr, 0);
! }
return NULL_TREE;
}