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]

Another case of DCE deleting live code


Here's a simplified version of the ACATS test of the same name:

PROCEDURE C43214C IS
   SUBTYPE STB IS STRING(5 .. 8);
   GENERIC
      B1 : STB;
   PROCEDURE PROC1;
   PROCEDURE PROC1 IS
   BEGIN
      IF B1 /= "ABCD" THEN
	 raise Program_Error;
      END IF;
   END;
   PROCEDURE PROC2 IS NEW PROC1 ("ABCD");
BEGIN
   PROC2;
END C43214C;

Note the assignment to FRAME.2.proc2GP222___b1 and that it gets deleted,
but it's very much not dead!

Here's the copyrename1 file:

C43214C ()
{
  typedef character c43214c__proc2__T3b[1 .. 4];
  typedef <unnamed type> struct <unnamed type>;
  integer D.410;
  character[1 .. 4] * proc2GP222__b1.1;
  character[5 .. 8] * proc2GP222__b1.0;
  struct FRAME.c43214c * CHAIN.3;
  character proc2GP222__b1[5 .. 8];
  typedef character c43214c__proc2GP222__T2b[5 .. 8];
  typedef <unnamed type> struct <unnamed type>;
  typedef character c43214c__stb[5 .. 8];
  typedef <unnamed type> struct <unnamed type>;
  typedef c43214c__TstbP1___XDLU_5__8 c43214c__TstbP1___XDLU_5__8;
  struct FRAME.c43214c FRAME.2;

<bb 0>:
  #   FRAME.2_2 = V_MAY_DEF <FRAME.2_1>;
  FRAME.2.proc2GP222__b1 = "ABCD";
  CHAIN.3_3 = &FRAME.2;
  proc2GP222__b1.0_4 = &CHAIN.3_3->proc2GP222__b1;
  proc2GP222__b1.1_5 = (character[1 .. 4] *) proc2GP222__b1.0_4;
  #   TMT.5_8 = V_MAY_DEF <TMT.5_7>;
  D.410_6 = __builtin_memcmp ("ABCD", proc2GP222__b1.1_5, 4);
  if (D.410_6 != 0) goto <L0>; else goto <L3>;

<L0>:;
  #   VUSE <TMT.5_8>;
  __gnat_rcheck_16 ("c43214c.adb", 12);

<L3>:;
  return;
}

And here's the dce1 file:

C43214C ()
{
  typedef character c43214c__proc2__T3b[1 .. 4];
  typedef <unnamed type> struct <unnamed type>;
  integer D.410;
  character[1 .. 4] * proc2GP222__b1.1;
  character[5 .. 8] * proc2GP222__b1.0;
  struct FRAME.c43214c * CHAIN.3;
  character proc2GP222__b1[5 .. 8];
  typedef character c43214c__proc2GP222__T2b[5 .. 8];
  typedef <unnamed type> struct <unnamed type>;
  typedef character c43214c__stb[5 .. 8];
  typedef <unnamed type> struct <unnamed type>;
  typedef c43214c__TstbP1___XDLU_5__8 c43214c__TstbP1___XDLU_5__8;
  struct FRAME.c43214c FRAME.2;

<bb 0>:
  CHAIN.3_3 = &FRAME.2;
  proc2GP222__b1.0_4 = &CHAIN.3_3->proc2GP222__b1;
  proc2GP222__b1.1_5 = (character[1 .. 4] *) proc2GP222__b1.0_4;
  #   TMT.5_8 = V_MAY_DEF <TMT.5_7>;
  D.410_6 = __builtin_memcmp ("ABCD", proc2GP222__b1.1_5, 4);
  if (D.410_6 != 0) goto <L0>; else goto <L3>;

<L0>:;
  #   VUSE <TMT.5_8>;
  __gnat_rcheck_16 ("c43214c.adb", 12);

<L3>:;
  return;
}

Here's the first part of the .alias1 file, in case that's useful:

c43214c: Total number of aliased vops: 1

Referenced variables in c43214c: 8

Variable: FRAME.2, UID 0, struct FRAME.c43214c, is an alias tag, is addressable, default def: FRAME.2_1

Variable: CHAIN.3, UID 1, struct FRAME.c43214c *, type memory tag: TMT.4
Variable: proc2GP222__b1.0, UID 2, character[5 .. 8] *
Variable: proc2GP222__b1.1, UID 3, character[1 .. 4] *, type memory tag: TMT.5
Variable: D.410, UID 4, integer

Variable: TMT.4, UID 5, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }

Variable: TMT.5, UID 6, character[1 .. 4], is addressable, is global, call clobbered

Variable: NMT.6, UID 7, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }

Pointed-to sets for pointers in C43214C

CHAIN.3_3, name memory tag: NMT.6, is dereferenced, points-to vars: { FRAME.2 }
proc2GP222__b1.0_4
proc2GP222__b1.1_5, is dereferenced, its value escapes, points-to anything

Flow-insensitive alias information for C43214C

Aliased symbols

FRAME.2, UID 0, struct FRAME.c43214c, is an alias tag, is addressable, default def: FRAME.2_1
TMT.4, UID 5, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }
TMT.5, UID 6, character[1 .. 4], is addressable, is global, call clobbered
NMT.6, UID 7, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }

Dereferenced pointers

CHAIN.3, UID 1, struct FRAME.c43214c *, type memory tag: TMT.4
proc2GP222__b1.1, UID 3, character[1 .. 4] *, type memory tag: TMT.5

Type memory tags

TMT.4, UID 5, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }
TMT.5, UID 6, character[1 .. 4], is addressable, is global, call clobbered

Flow-sensitive alias information for C43214C

SSA_NAME pointers

CHAIN.3_3, name memory tag: NMT.6, is dereferenced, points-to vars: { FRAME.2 }

Name memory tags

NMT.6, UID 7, struct FRAME.c43214c, is addressable, may aliases: { FRAME.2 }


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