Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
fa7eb6ee
Commit
fa7eb6ee
authored
Feb 23, 2016
by
yb9976
Browse files
Check for equal modes before subtracting them.
This fixes opt/boolopt4.c.
parent
fe67e457
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/opt/boolopt.c
View file @
fa7eb6ee
...
...
@@ -178,7 +178,7 @@ static ir_node *bool_and(cond_pair* const cpair, ir_node *dst_block)
(
rel_hi
==
ir_relation_equal
||
rel_hi
==
ir_relation_greater_equal
||
rel_hi
==
ir_relation_greater
))
{
/* x >=|>|!= lo && x ==|>=|> hi ==> x ==|>=|> hi */
return
cmp_hi
;
}
else
if
(
tarval_is_one
(
tarval_sub
(
tv_hi
,
tv_lo
)))
{
/* lo + 1 == hi */
}
else
if
(
get_tarval_mode
(
tv_hi
)
==
get_tarval_mode
(
tv_lo
)
&&
tarval_is_one
(
tarval_sub
(
tv_hi
,
tv_lo
)))
{
/* lo + 1 == hi */
if
(
rel_lo
==
ir_relation_greater_equal
&&
rel_hi
==
ir_relation_less
)
{
/* x >= c && x < c + 1 ==> x == c */
return
make_Cmp
(
dst_block
,
cmp_lo
,
ir_relation_equal
);
...
...
@@ -309,7 +309,7 @@ static ir_node *bool_or(cond_pair *const cpair, ir_node *dst_block)
(
rel_hi
==
ir_relation_equal
||
rel_hi
==
ir_relation_greater_equal
||
rel_hi
==
ir_relation_greater
))
{
/* x >=|>|!= lo || x ==|>=|> hi ==> x >=|>|!= lo */
return
cmp_lo
;
}
else
if
(
tarval_is_one
(
tarval_sub
(
tv_hi
,
tv_lo
)))
{
/* lo + 1 == hi */
}
else
if
(
get_tarval_mode
(
tv_hi
)
==
get_tarval_mode
(
tv_lo
)
&&
tarval_is_one
(
tarval_sub
(
tv_hi
,
tv_lo
)))
{
/* lo + 1 == hi */
if
(
rel_lo
==
ir_relation_less
&&
rel_hi
==
ir_relation_greater_equal
)
{
/* x < c || x >= c + 1 ==> x != c */
return
make_Cmp
(
dst_block
,
cmp_lo
,
ir_relation_less_greater
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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