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
bf4d29aa
Commit
bf4d29aa
authored
Dec 11, 2013
by
yb9976
Browse files
Handle Cond nodes with constant condition.
parent
c90f94df
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/opt/jumpthreading.c
View file @
bf4d29aa
...
...
@@ -562,6 +562,20 @@ static void thread_jumps(ir_node* block, void* data)
/* (recursively) look if a pred of a Phi is a constant or a Confirm */
ir_node
*
selector
=
get_Cond_selector
(
cond
);
ir_graph
*
irg
=
get_irn_irg
(
block
);
if
(
is_Const
(
selector
))
{
const
ir_tarval
*
tv
=
get_Const_tarval
(
selector
);
assert
(
tv
==
tarval_b_false
||
tv
==
tarval_b_true
);
ir_node
*
const
cond_block
=
get_nodes_block
(
cond
);
ir_node
*
const
jmp
=
new_r_Jmp
(
cond_block
);
ir_node
*
const
bad
=
new_r_Bad
(
irg
,
mode_X
);
const
bool
is_true
=
tv
==
tarval_b_true
;
ir_node
*
const
in
[]
=
{
[
pn_Cond_false
]
=
is_true
?
bad
:
jmp
,
[
pn_Cond_true
]
=
is_true
?
jmp
:
bad
,
};
turn_into_tuple
(
cond
,
ARRAY_SIZE
(
in
),
in
);
return
;
}
inc_irg_visited
(
irg
);
jumpthreading_env_t
env
;
env
.
cnst_pred
=
NULL
;
...
...
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