public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
@ 2005-03-31 9:46 kazu at cs dot umass dot edu
2005-03-31 9:50 ` [Bug tree-optimization/20702] " kazu at cs dot umass dot edu
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-03-31 9:46 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/20702] [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
@ 2005-03-31 9:50 ` kazu at cs dot umass dot edu
2005-04-01 16:23 ` kazu at cs dot umass dot edu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-03-31 9:50 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |kazu at cs dot umass dot edu
|dot org |
Status|UNCONFIRMED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/20702] [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
2005-03-31 9:50 ` [Bug tree-optimization/20702] " kazu at cs dot umass dot edu
@ 2005-04-01 16:23 ` kazu at cs dot umass dot edu
2005-04-13 14:56 ` kazu at cs dot umass dot edu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-01 16:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2005-04-01 16:23 -------
Let me replace the testcase as follows so that
I can remove dependence on PR 20701.
extern void bar (int);
int
foo (int *p, int b)
{
int a;
if (b)
bar (123);
else
bar (321);
a = *p;
if (p == 0)
return 0;
return a;
}
Note that "p == 0" in the second "if" statement is always false,
but VRP does not fold it.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|20701 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/20702] [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
2005-03-31 9:50 ` [Bug tree-optimization/20702] " kazu at cs dot umass dot edu
2005-04-01 16:23 ` kazu at cs dot umass dot edu
@ 2005-04-13 14:56 ` kazu at cs dot umass dot edu
2005-04-13 18:14 ` kazu at cs dot umass dot edu
2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-13 14:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2005-04-13 14:56 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2005-04/msg01456.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/20702] [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2005-04-13 14:56 ` kazu at cs dot umass dot edu
@ 2005-04-13 18:14 ` kazu at cs dot umass dot edu
2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-04-13 18:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2005-04-13 18:14 -------
Just checked in a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug tree-optimization/20702] [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present.
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2005-04-13 18:14 ` kazu at cs dot umass dot edu
@ 2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-13 18:16 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20702
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-04-13 18:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-31 9:46 [Bug tree-optimization/20702] New: [tcb] ASSERT_EXPRs are not inserted when a certain "if" statement is present kazu at cs dot umass dot edu
2005-03-31 9:50 ` [Bug tree-optimization/20702] " kazu at cs dot umass dot edu
2005-04-01 16:23 ` kazu at cs dot umass dot edu
2005-04-13 14:56 ` kazu at cs dot umass dot edu
2005-04-13 18:14 ` kazu at cs dot umass dot edu
2005-04-13 18:16 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).