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
c2202b70
Commit
c2202b70
authored
Sep 02, 2015
by
yb9976
Browse files
Prevent optimization if compare relation is trivial.
This fixes opt/fehler302.c.
parent
3c5129c4
Changes
1
Show whitespace changes
Inline
Side-by-side
ir/ir/iropt.c
View file @
c2202b70
...
@@ -5398,11 +5398,12 @@ cmp_x_eq_0:
...
@@ -5398,11 +5398,12 @@ cmp_x_eq_0:
/* for integer modes, we have more */
/* for integer modes, we have more */
if
(
mode_is_int
(
mode
)
&&
!
is_Const
(
left
))
{
if
(
mode_is_int
(
mode
)
&&
!
is_Const
(
left
))
{
if
(
!
is_relation
(
ir_relation_false
,
relation
,
possible
)
&&
!
is_relation
(
ir_relation_true
,
relation
,
possible
))
{
if
((
relation
==
ir_relation_less
||
relation
==
ir_relation_greater_equal
)
&&
if
((
relation
==
ir_relation_less
||
relation
==
ir_relation_greater_equal
)
&&
tarval_cmp
(
tv
,
get_mode_null
(
mode
))
==
ir_relation_greater
)
{
tarval_cmp
(
tv
,
get_mode_null
(
mode
))
==
ir_relation_greater
)
{
bitinfo
const
*
const
bl
=
get_bitinfo
(
left
);
bitinfo
const
*
const
bl
=
get_bitinfo
(
left
);
if
(
bl
&&
!
is_relation
(
ir_relation_false
,
relation
,
possible
)
if
(
bl
)
{
&&
!
is_relation
(
ir_relation_true
,
relation
,
possible
))
{
ir_tarval
*
const
uneq
=
tarval_or
(
tarval_andnot
(
tv
,
bl
->
z
),
tarval_andnot
(
bl
->
o
,
tv
));
ir_tarval
*
const
uneq
=
tarval_or
(
tarval_andnot
(
tv
,
bl
->
z
),
tarval_andnot
(
bl
->
o
,
tv
));
int
const
hi
=
get_tarval_highest_bit
(
uneq
);
int
const
hi
=
get_tarval_highest_bit
(
uneq
);
if
(
hi
>=
0
)
{
if
(
hi
>=
0
)
{
...
@@ -5427,8 +5428,7 @@ cmp_x_eq_0:
...
@@ -5427,8 +5428,7 @@ cmp_x_eq_0:
}
else
if
((
relation
==
ir_relation_greater
||
relation
==
ir_relation_less_equal
)
&&
}
else
if
((
relation
==
ir_relation_greater
||
relation
==
ir_relation_less_equal
)
&&
tarval_cmp
(
tv
,
get_mode_null
(
mode
))
==
ir_relation_less
)
{
tarval_cmp
(
tv
,
get_mode_null
(
mode
))
==
ir_relation_less
)
{
bitinfo
const
*
const
bl
=
get_bitinfo
(
left
);
bitinfo
const
*
const
bl
=
get_bitinfo
(
left
);
if
(
bl
&&
!
is_relation
(
ir_relation_false
,
relation
,
possible
)
if
(
bl
)
{
&&
!
is_relation
(
ir_relation_true
,
relation
,
possible
))
{
ir_tarval
*
const
uneq
=
tarval_or
(
tarval_andnot
(
tv
,
bl
->
z
),
tarval_andnot
(
bl
->
o
,
tv
));
ir_tarval
*
const
uneq
=
tarval_or
(
tarval_andnot
(
tv
,
bl
->
z
),
tarval_andnot
(
bl
->
o
,
tv
));
int
const
hi
=
get_tarval_highest_bit
(
uneq
);
int
const
hi
=
get_tarval_highest_bit
(
uneq
);
if
(
hi
>=
0
)
{
if
(
hi
>=
0
)
{
...
@@ -5457,6 +5457,7 @@ reduced_tv:
...
@@ -5457,6 +5457,7 @@ reduced_tv:
changedc
=
true
;
changedc
=
true
;
DBG_OPT_ALGSIM0
(
n
,
n
,
FS_OPT_CMP_CNST_MAGN
);
DBG_OPT_ALGSIM0
(
n
,
n
,
FS_OPT_CMP_CNST_MAGN
);
}
}
}
/* the following reassociations work only for == and != */
/* the following reassociations work only for == and != */
if
(
rel_eq
!=
ir_relation_false
)
{
if
(
rel_eq
!=
ir_relation_false
)
{
...
...
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