This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Mar 2005 09:45:53 -0000
- Subject: [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
typedef struct {
int code;
} *rtx;
extern void next_active_insn (rtx);
int
can_combine_p (rtx insn, rtx succ, rtx elt)
{
rtx set = 0;
if (succ)
next_active_insn (succ);
else
next_active_insn (insn);
if (insn->code == 3)
set = insn;
else if (insn->code == 5)
{
set = elt;
if (set == 0)
return 0;
}
else
return 0;
if (set == 0)
return 1;
return 0;
}
Here is the dump after inserting ASSERT_EXPRs.
can_combine_p (insn, succ, elt)
{
struct
{
int code;
} * set;
int D.1141;
int D.1140;
<bb 0>:
if (succ_4 != 0B) goto <L0>; else goto <L1>;
<L0>:;
succ_8 = ASSERT_EXPR <succ_4, succ_4 != 0B>;
next_active_insn (succ_8);
goto <bb 3> (<L2>);
<L1>:;
succ_9 = 0B;
next_active_insn (insn_5);
<L2>:;
D.1140_6 = insn_5->code;
if (D.1140_6 == 3) goto <L9>; else goto <L4>;
<L4>:;
D.1140_10 = D.1140_6;
if (D.1140_10 == 5) goto <L5>; else goto <L13>;
<L5>:;
if (elt_12 == 0B) goto <L13>; else goto <L9>;
# set_1 = PHI <insn_5(3), elt_12(5)>;
<L9>:;
if (set_1 == 0B) goto <L11>; else goto <L13>;
<L11>:;
# D.1141_2 = PHI <0(5), 0(4), 1(7), 0(6)>;
<L13>:;
return D.1141_2;
}
Note that we don't have ASSERT_EXPRs for "if" statements and memory access
that happen later in the function.
I've got a preliminary patch working.
--
Summary: [tcb] ASSERT_EXPRs are not inserted when a certain "if"
statement is present.
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: dnovillo at redhat dot com,gcc-bugs at gcc dot gnu dot
org
BugsThisDependsOn: 20701
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702