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

[LRA] liveness update not done after elimination??


Hello Vlad,

Is it intentional that DF_LR_IN and DF_LR_OUT are not updated after
"Updating elimination of equiv for reg..."? I have some checking in
place in process_bb_lives at the end of the function, and it triggers
on the test case. (Checking code and test case is at the end of this
e-mail.) It show:

LIVEIN-mismatch in bb 5:
66, 69,
66, 69, 73
73
t.c: In function 'get_mem_attrs':
t.c:47:1: internal compiler error: in process_bb_lives, at lra-lives.c:866
 }
 ^

And that's correct if you look at the LR_IN set of basic block 5 in
the IRA  (.193r.ira) dump:

;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot
...
    9 r73:SI=[argp:DI]
      REG_EQUIV: [argp:DI]
...
;; lr  out       6 [bp] 7 [sp] 16 [argp] 20 [frame] 66 69 73
...
;; basic block 5, loop depth 0, count 0, freq 5014, maybe hot
;;  prev block 4, next block 6, flags: (RTL)
;;  pred:       4
;; bb 5 artificial_defs: { }
;; bb 5 artificial_uses: { u22(6){ }u23(7){ }u24(16){ }u25(20){ }}
;; lr  in        6 [bp] 7 [sp] 16 [argp] 20 [frame] 66 69 73
;; lr  use       6 [bp] 7 [sp] 16 [argp] 20 [frame] 69 73
;; lr  def       17 [flags] 74 76
;; live  in      6 [bp] 7 [sp] 16 [argp] 20 [frame] 66 69 73
;; live  gen     17 [flags] 74 76
;; live  kill
   23 NOTE_INSN_BASIC_BLOCK
   24 r74:DI=sign_extend(r73:SI)
      REG_DEAD: r73:SI
   26 r76:DI=zero_extend([r74:DI+`mode_size'])
      REG_DEAD: r74:DI
   27 flags:CCZ=cmp(r76:DI,[r69:DI])
      REG_DEAD: r76:DI
      REG_DEAD: r69:DI
   28 pc={(flags:CCZ==0)?L57:pc}
      REG_DEAD: flags:CCZ
      REG_BR_PROB: 0x19e
;;  succ:       8
;;              6
;; lr  out       6 [bp] 7 [sp] 16 [argp] 20 [frame] 66
;; live  out     6 [bp] 7 [sp] 16 [argp] 20 [frame] 66


But that insn setting reg 73 has been eliminated according to the LRA
(.194r.reload) dump:

Updating elimination of equiv for reg 73
...
      Removing equiv init insn 9 (freq=10000)
    9 r73:SI=[argp:DI+0x30]
      REG_EQUIV: [argp:DI]
deleting insn with uid = 9.
         Choosing alt 0 in insn 15:  (0) r
         Choosing alt 0 in insn 18:  (0) r
Changing pseudo 73 in operand 0 of insn 21 on equiv [argp:DI+0x30]
         Choosing alt 0 in insn 21:  (0) rm  (1) re
Changing pseudo 73 in operand 1 of insn 24 on equiv [argp:DI+0x30]
         Choosing alt 1 in insn 24:  (0) r  (1) rm
         Choosing alt 0 in insn 26:  (0) =r  (1) qm
         Choosing alt 1 in insn 27:  (0) r  (1) rm
         Choosing alt 1 in insn 31:  (0) m  (1) re

You do update the DF_LR sets elsewhere in LRA, so I was wondering if
it is intentional or not to leave the DF_LR sets unchanged after
elimination.

Ciao!
Steven



------------------ 8< ------------------

   EXECUTE_IF_SET_IN_SPARSESET (pseudos_live, i)
    mark_pseudo_dead (i);
+    {
+      bitmap b = BITMAP_ALLOC (&reg_obstack);
+      bitmap_copy (b, DF_LR_IN (bb));
+      bitmap_clear_range (b, 0, FIRST_PSEUDO_REGISTER);
+      EXECUTE_IF_SET_IN_BITMAP (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, j, bi)
+        if (sparseset_bit_p (pseudos_live, j))
+          bitmap_clear_bit (b, j);
+      if (! bitmap_empty_p (b))
+        {
+          fprintf (stderr, "LIVEIN-mismatch in bb %d:\n", bb->index);
+          EXECUTE_IF_SET_IN_BITMAP (DF_LR_IN (bb),
FIRST_PSEUDO_REGISTER, j, bi)
+            if (sparseset_bit_p (pseudos_live, j))
+              fprintf (stderr, "%u, ", j);
+          fprintf (stderr, "\n");
+          bitmap_clear_range (DF_LR_IN (bb), 0, FIRST_PSEUDO_REGISTER);
+          dump_bitmap (stderr, DF_LR_IN (bb));
+          dump_bitmap (stderr, b);
+          gcc_unreachable ();
+        }
+      BITMAP_FREE (b);
+    }
------------------ 8< ------------------

------------------ 8< ------------------
typedef long unsigned int size_t;

union tree_node;
typedef union tree_node *tree;
struct rtx_def;
typedef struct rtx_def *rtx;

struct rtx_def {
  union u {
    long hwint[1];
  } u;
};

typedef struct mem_attrs
{
  tree expr;
  rtx offset;
  rtx size;
  int alias;
  unsigned int align;
} mem_attrs;

extern void *ggc_alloc_stat (size_t);

typedef struct htab *htab_t;
extern void ** htab_find_slot (htab_t, const void *, int);
static htab_t mem_attrs_htab;

extern unsigned char mode_size[256];

mem_attrs *get_mem_attrs (int, tree, rtx, rtx, unsigned int,
                          unsigned char, int);

mem_attrs *
get_mem_attrs (int alias, tree expr, rtx offset, rtx size,
               unsigned int align, unsigned char addrspace, int mode)
{
  mem_attrs attrs;
  void **slot;
  if (alias == 0
      && (size == 0
          || (mode != 1 && mode_size[mode] == size->u.hwint[0])))
    return 0;
  attrs.alias = alias;
  slot = htab_find_slot (mem_attrs_htab, &attrs, 1);
  return (mem_attrs *) *slot;
}
------------------ 8< ------------------


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