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
2f191c89
Commit
2f191c89
authored
Sep 30, 2016
by
Christoph Mallon
Browse files
opt: Simplify computed goto with known destination to unconditional branch.
parent
a697cdf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
NEWS.md
View file @
2f191c89
...
...
@@ -36,6 +36,7 @@ libFirm 1.22.1 (2016-01-07)
*
sparc: Support the asm constaint
`K`
*
sparc: Support computed goto
*
arm: Support computed goto
*
opt: Simplify computed goto with known destination to unconditional branch
*
Bugfixes
libFirm 1.22.0 (2015-12-31)
...
...
ir/opt/iropt.c
View file @
2f191c89
...
...
@@ -5740,11 +5740,28 @@ static ir_node *transform_node_Block(ir_node *block)
ir_node
*
bad
=
NULL
;
for
(
int
i
=
0
;
i
<
arity
;
++
i
)
{
ir_node
*
const
pred
=
get_Block_cfgpred
(
block
,
i
);
if
(
is_Bad
(
pred
)
||
!
is_block_unreachable
(
get_nodes_block
(
pred
)))
if
(
is_Bad
(
pred
)
)
{
continue
;
if
(
bad
==
NULL
)
bad
=
new_r_Bad
(
irg
,
mode_X
);
set_irn_n
(
block
,
i
,
bad
);
}
else
if
(
is_block_unreachable
(
get_nodes_block
(
pred
)))
{
goto
bad
;
}
else
if
(
is_IJmp
(
pred
))
{
ir_node
*
const
target
=
get_IJmp_target
(
pred
);
if
(
is_Address
(
target
))
{
ir_entity
*
const
entity
=
get_Address_entity
(
target
);
if
(
entity
==
get_Block_entity
(
block
))
{
/* BB[x](..., IJmp(Adress[x]), ...) ==> BB[x](..., Jmp, ...) */
dbg_info
*
const
dbgi
=
get_irn_dbg_info
(
pred
);
ir_node
*
const
jmp
=
new_rd_Jmp
(
dbgi
,
get_nodes_block
(
pred
));
set_irn_n
(
block
,
i
,
jmp
);
}
else
{
/* BB[x](..., IJmp(Adress[y]), ...), x != y ==> BB[x](..., Bad, ...) */
bad:
if
(
!
bad
)
bad
=
new_r_Bad
(
irg
,
mode_X
);
set_irn_n
(
block
,
i
,
bad
);
}
}
}
}
return
block
;
...
...
Write
Preview
Markdown
is supported
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