On Mon, 2 Dec 2013, Richard Biener wrote:

> On Mon, 2 Dec 2013, Jakub Jelinek wrote:
> 
> > On Mon, Dec 02, 2013 at 12:05:57PM +0100, Richard Biener wrote:
> > > 
> > > The following fixes a bug in update_address_taken which fails
> > > to reset debug stmts which take the address of a decl we will
> > > rewrite into SSA form.  Our verifiers don't catch this because
> > > of an early out in the operand scanner which doesn't work in
> > > the specific case of LTO profiledbootstrap (or because we
> > > don't have more specific checking for this case).
> > > 
> > > Fixed like the following.
> > > 
> > > LTO profiledbootstrapped on x86_64-unknown-linux-gnu, regular
> > > bootstrap & regtest still running.
> > 
> > Taking address of a decl that is no longer addressable in debug stmts
> > is correct, that is how we generate DW_OP_GNU_implicit_ptr.
> > So I think this patch is going to cause huge amount of debug info quality
> > regressions.
> 
> Does it?  Note the decls in question will be renamed to SSA form,
> so not sure what "implicit" pointer you'll build here...?  And
> what can you do with that pointer inside the debugger?
> 
> If that's desired IL (having both DECL and SSA_NAMEs of that DECL
> in the IL) then explicit support for this needs to be added to
> the operand scanner.

Like the following, LTO profilebootstrapped on x86_64-unknown-linux-gnu,
bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
(must resist applying more TLC to tree-ssa-operands.c at this point...)

Richard.

2013-12-02  Richard Biener  <rguent...@suse.de>

        * tree-ssa-operands.c (opf_implicit): Remove.
        (opf_address_taken): New flag.
        (get_expr_operands): Remove early out, pass down
        opf_address_taken for ADDR_EXPRs, add a use operand only
        for non-opf_address_taken bases.
        (get_indirect_ref_operands): Rename to ...
        (get_mem_ref_operands): ... this.
        (get_asm_expr_operands): Rename to ...
        (get_asm_stmt_operands): ... this.

Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c     (revision 205585)
--- gcc/tree-ssa-operands.c     (working copy)
*************** along with GCC; see the file COPYING3.
*** 105,121 ****
     VUSE for 'b'.  */
  #define opf_no_vops   (1 << 1)
  
- /* Operand is an implicit reference.  This is used to distinguish
-    explicit assignments in the form of MODIFY_EXPR from
-    clobbering sites like function calls or ASM_EXPRs.  */
- #define opf_implicit  (1 << 2)
- 
  /* Operand is in a place where address-taken does not imply addressable.  */
  #define opf_non_addressable (1 << 3)
  
  /* Operand is in a place where opf_non_addressable does not apply.  */
  #define opf_not_non_addressable (1 << 4)
  
  /* Array for building all the use operands.  */
  static vec<tree> build_uses;
  
--- 105,119 ----
     VUSE for 'b'.  */
  #define opf_no_vops   (1 << 1)
  
  /* Operand is in a place where address-taken does not imply addressable.  */
  #define opf_non_addressable (1 << 3)
  
  /* Operand is in a place where opf_non_addressable does not apply.  */
  #define opf_not_non_addressable (1 << 4)
  
+ /* Operand is having its address taken.  */
+ #define opf_address_taken (1 << 5)
+ 
  /* Array for building all the use operands.  */
  static vec<tree> build_uses;
  
*************** mark_address_taken (tree ref)
*** 597,604 ****
     FLAGS is as in get_expr_operands.  */
  
  static void
! get_indirect_ref_operands (struct function *fn,
!                          gimple stmt, tree expr, int flags)
  {
    tree *pptr = &TREE_OPERAND (expr, 0);
  
--- 595,602 ----
     FLAGS is as in get_expr_operands.  */
  
  static void
! get_mem_ref_operands (struct function *fn,
!                     gimple stmt, tree expr, int flags)
  {
    tree *pptr = &TREE_OPERAND (expr, 0);
  
*************** maybe_add_call_vops (struct function *fn
*** 664,670 ****
  /* Scan operands in the ASM_EXPR stmt referred to in INFO.  */
  
  static void
! get_asm_expr_operands (struct function *fn, gimple stmt)
  {
    size_t i, noutputs;
    const char **oconstraints;
--- 662,668 ----
  /* Scan operands in the ASM_EXPR stmt referred to in INFO.  */
  
  static void
! get_asm_stmt_operands (struct function *fn, gimple stmt)
  {
    size_t i, noutputs;
    const char **oconstraints;
*************** get_expr_operands (struct function *fn,
*** 750,760 ****
          && !is_gimple_debug (stmt))
        mark_address_taken (TREE_OPERAND (expr, 0));
  
-       /* If the address is invariant, there may be no interesting
-        variable references inside.  */
-       if (is_gimple_min_invariant (expr))
-       return;
- 
        /* Otherwise, there may be variables referenced inside but there
         should be no VUSEs created, since the referenced objects are
         not really accessed.  The only operands that we should find
--- 748,753 ----
*************** get_expr_operands (struct function *fn,
*** 762,775 ****
         (GIMPLE does not allow non-registers as array indices).  */
        flags |= opf_no_vops;
        get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0),
!                        flags | opf_not_non_addressable);
        return;
  
      case SSA_NAME:
      case VAR_DECL:
      case PARM_DECL:
      case RESULT_DECL:
!       add_stmt_operand (fn, expr_p, stmt, flags);
        return;
  
      case DEBUG_EXPR_DECL:
--- 755,769 ----
         (GIMPLE does not allow non-registers as array indices).  */
        flags |= opf_no_vops;
        get_expr_operands (fn, stmt, &TREE_OPERAND (expr, 0),
!                        flags | opf_not_non_addressable | opf_address_taken);
        return;
  
      case SSA_NAME:
      case VAR_DECL:
      case PARM_DECL:
      case RESULT_DECL:
!       if (!(flags & opf_address_taken))
!       add_stmt_operand (fn, expr_p, stmt, flags);
        return;
  
      case DEBUG_EXPR_DECL:
*************** get_expr_operands (struct function *fn,
*** 777,783 ****
        return;
  
      case MEM_REF:
!       get_indirect_ref_operands (fn, stmt, expr, flags);
        return;
  
      case TARGET_MEM_REF:
--- 771,777 ----
        return;
  
      case MEM_REF:
!       get_mem_ref_operands (fn, stmt, expr, flags);
        return;
  
      case TARGET_MEM_REF:
*************** parse_ssa_operands (struct function *fn,
*** 921,927 ****
    switch (code)
      {
      case GIMPLE_ASM:
!       get_asm_expr_operands (fn, stmt);
        break;
  
      case GIMPLE_TRANSACTION:
--- 915,921 ----
    switch (code)
      {
      case GIMPLE_ASM:
!       get_asm_stmt_operands (fn, stmt);
        break;
  
      case GIMPLE_TRANSACTION:

Reply via email to