Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
73be8b7f
Commit
73be8b7f
authored
Sep 13, 2007
by
Michael Beck
Browse files
fixed two bugs, ~a == C case added
[r15789]
parent
12ddbbbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
73be8b7f
...
...
@@ -3261,7 +3261,7 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
left
=
lr
;
right
=
rl
;
changed
|=
1
;
}
else
if
(
lr
=
rl
)
{
}
else
if
(
lr
=
=
rl
)
{
/* a + X CMP X + b ==> a CMP b */
left
=
ll
;
right
=
rr
;
...
...
@@ -3366,16 +3366,23 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
* be optimized, see this:
* -MININT < 0 =/=> MININT > 0 !!!
*/
if
(
get_opt_constant_folding
()
&&
get_irn_op
(
left
)
==
op_Minus
&&
if
(
is_Minus
(
left
)
&&
(
!
mode_overflow_on_unary_Minus
(
mode
)
||
(
mode_is_int
(
mode
)
&&
(
proj_nr
==
pn_Cmp_Eq
||
proj_nr
==
pn_Cmp_Lg
))))
{
left
=
get_Minus_op
(
left
);
tv
=
tarval_neg
(
tv
);
if
(
tv
!=
tarval_bad
)
{
left
=
get_Minus_op
(
left
);
proj_nr
=
get_inversed_pnc
(
proj_nr
);
changed
|=
2
;
}
}
else
if
(
is_Not
(
left
)
&&
(
proj_nr
==
pn_Cmp_Eq
||
proj_nr
==
pn_Cmp_Lg
))
{
tv
=
tarval_not
(
tv
);
if
(
tv
!=
tarval_bad
)
{
left
=
get_Not_op
(
left
);
changed
|=
2
;
}
}
/* for integer modes, we have more */
...
...
@@ -3412,14 +3419,12 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
if
(
proj_nr
==
pn_Cmp_Eq
||
proj_nr
==
pn_Cmp_Lg
)
{
/* a-b == 0 ==> a == b, a-b != 0 ==> a != b */
if
(
classify_tarval
(
tv
)
==
TV_CLASSIFY_NULL
&&
get_irn_op
(
left
)
==
op_Sub
)
{
right
=
get_Sub_right
(
left
);
if
(
classify_tarval
(
tv
)
==
TV_CLASSIFY_NULL
&&
is_Sub
(
left
)
)
{
right
=
get_Sub_right
(
left
);
left
=
get_Sub_left
(
left
);
tv
=
value_of
(
right
);
if
(
tv
!=
tarval_bad
)
{
changed
=
1
;
}
changed
=
1
;
}
if
(
tv
!=
tarval_bad
)
{
...
...
@@ -3522,8 +3527,7 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) {
right
=
new_Const
(
mode
,
tv
);
/* create a new compare */
n
=
new_rd_Cmp
(
get_irn_dbg_info
(
n
),
current_ir_graph
,
block
,
left
,
right
);
n
=
new_rd_Cmp
(
get_irn_dbg_info
(
n
),
current_ir_graph
,
block
,
left
,
right
);
set_Proj_pred
(
proj
,
n
);
set_Proj_proj
(
proj
,
proj_nr
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment