[Bug debug/43222] two DEBUG i => 0 generated after loop copy header

aoliva at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 2 06:28:00 GMT 2010



------- Comment #6 from aoliva at gcc dot gnu dot org  2010-06-02 06:28 -------
Andrew, the debug stmts are indeed originally from the loop header's PHI nodes.
Before ch we have:

i_1 = <init>;
# i => i_1
goto <header>;

<body>:
i_3 = <whatever>(i_2);
# i => i_3

<header>:
i_2 = PHI <i_1, i_3>;
# i => i_2
if (<cond>) goto <body>; else goto <exit>;

copy_loop_header turns this into:

i_1 = <init>;
# i => i_1

<copy>:
i_4 = PHI <i_1>;
# i => i_4
if (<cond>) goto <body>; else goto <exit>;

<body>:
i_3 = <whatever>(i_2);
# i => i_3

<header>:
i_2 = PHI <i_3>;
# i => i_2
if (<cond>) goto <body>; else goto <exit>;

and that's correct.  Then cfgcleanup realizes the headers can be merged with
their preds, and that kills the PHI nodes, but there's no reason why this
should kill the debug stmts.

Of course we could arrange for some cleanup passes to detect and remove debug
stmts in case they become redundant, but I don't see that we have a bug here.


-- 


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



More information about the Gcc-bugs mailing list