This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/37573] [4.4 Regression] gcc-4.4 regression: incorrect code generation with -O1 -ftree-vectorize



------- Comment #7 from spop at gcc dot gnu dot org  2008-10-15 21:28 -------
split_constant_offset does not handle correctly the offset of
&s.c[1] as this is an ADDR_EXPR whose op0 was set by 
extract_ops_from_tree to itself, an ADDR_EXPR.  Now this code
is not handled in split_constant_offset_1 as this calls

        if (!handled_component_p (op0))
          return false;

and returns false.  This is an early return that stops the extraction
of the base address of the array: s.c[0] and the offset 4.

This is probably due to the fact that extract_ops_from_tree does
return the expression itself for ADDR_EXPRs in this case:

  else if (grhs_class == GIMPLE_SINGLE_RHS)
    {
      *op1_p = expr;
      *op2_p = NULL_TREE;
    }

I wonder if the fix could be to handle ADDR_EXPRs as GIMPLE_UNARY_RHS
instead of GIMPLE_SINGLE_RHS:

  else if (grhs_class == GIMPLE_UNARY_RHS)
    {
      *op1_p = TREE_OPERAND (expr, 0);
      *op2_p = NULL_TREE;
    }

in which case that would solve the base and offset computations.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37573


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