projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
detect fully/partly redundant by inspection node index ...
[libfirm]
/
ir
/
opt
/
boolopt.c
diff --git
a/ir/opt/boolopt.c
b/ir/opt/boolopt.c
index
5ddcd94
..
45289d4
100644
(file)
--- a/
ir/opt/boolopt.c
+++ b/
ir/opt/boolopt.c
@@
-100,7
+100,7
@@
static ir_node *bool_and(cond_pair* const cpair)
(pnc_hi == pn_Cmp_Eq || pnc_hi == pn_Cmp_Ge || pnc_hi == pn_Cmp_Gt)) {
/* x >=|>|!= lo || x ==|>=|> hi -> x ==|>=|> hi */
return proj_hi;
(pnc_hi == pn_Cmp_Eq || pnc_hi == pn_Cmp_Ge || pnc_hi == pn_Cmp_Gt)) {
/* x >=|>|!= lo || x ==|>=|> hi -> x ==|>=|> hi */
return proj_hi;
- } else if (tarval_is_one(tarval_sub(tv_hi, tv_lo))) { /* lo + 1 == hi */
+ } else if (tarval_is_one(tarval_sub(tv_hi, tv_lo
, NULL
))) { /* lo + 1 == hi */
if (pnc_lo == pn_Cmp_Ge && pnc_hi == pn_Cmp_Lt) {
/* x >= c || x < c + 1 -> x == c */
ir_graph *const irg = current_ir_graph;
if (pnc_lo == pn_Cmp_Ge && pnc_hi == pn_Cmp_Lt) {
/* x >= c || x < c + 1 -> x == c */
ir_graph *const irg = current_ir_graph;
@@
-161,7
+161,7
@@
static ir_node *bool_or(cond_pair *const cpair)
(pnc_hi == pn_Cmp_Eq || pnc_hi == pn_Cmp_Ge || pnc_hi == pn_Cmp_Gt)) {
/* x >=|>|!= lo || x ==|>=|> hi -> x >=|>|!= lo */
return proj_lo;
(pnc_hi == pn_Cmp_Eq || pnc_hi == pn_Cmp_Ge || pnc_hi == pn_Cmp_Gt)) {
/* x >=|>|!= lo || x ==|>=|> hi -> x >=|>|!= lo */
return proj_lo;
- } else if (tarval_is_one(tarval_sub(tv_hi, tv_lo))) { /* lo + 1 == hi */
+ } else if (tarval_is_one(tarval_sub(tv_hi, tv_lo
, NULL
))) { /* lo + 1 == hi */
if (pnc_lo == pn_Cmp_Lt && pnc_hi == pn_Cmp_Ge) {
/* x < c || x >= c + 1 -> x != c */
ir_graph *const irg = current_ir_graph;
if (pnc_lo == pn_Cmp_Lt && pnc_hi == pn_Cmp_Ge) {
/* x < c || x >= c + 1 -> x != c */
ir_graph *const irg = current_ir_graph;
@@
-264,7
+264,12
@@
static void collect_phis(ir_node *node, void *env)
}
}
}
}
-ir_node *skip_empty_block(ir_node *node)
+/**
+ * If node is a Jmp in a block containing no pinned instruction
+ * and having only one predecessor, skip the block and return its
+ * cf predecessor, else the node itself.
+ */
+static ir_node *skip_empty_block(ir_node *node)
{
ir_node *block;
{
ir_node *block;
@@
-314,22
+319,22
@@
restart:
if(!is_Proj(lower_cf))
continue;
if(!is_Proj(lower_cf))
continue;
- lower_block = get_nodes_block(lower_cf);
- if(get_Block_n_cfgpreds(lower_block) != 1)
- continue;
-
cond = get_Proj_pred(lower_cf);
if(!is_Cond(cond))
continue;
cond = get_Proj_pred(lower_cf);
if(!is_Cond(cond))
continue;
-
cond_selector = get_Cond_selector
(cond);
- if(get_
irn_mode(cond_selector) != mode_b
)
+
lower_block = get_nodes_block
(cond);
+ if(get_
Block_n_cfgpreds(lower_block) != 1
)
continue;
/* the block must not produce any side-effects */
if(get_Block_mark(lower_block))
continue;
continue;
/* the block must not produce any side-effects */
if(get_Block_mark(lower_block))
continue;
+ cond_selector = get_Cond_selector(cond);
+ if(get_irn_mode(cond_selector) != mode_b)
+ continue;
+
lower_pred = get_Block_cfgpred_block(lower_block, 0);
for(i2 = 0; i2 < n_cfgpreds; ++i2) {
lower_pred = get_Block_cfgpred_block(lower_block, 0);
for(i2 = 0; i2 < n_cfgpreds; ++i2) {
@@
-362,7
+367,7
@@
restart:
continue;
/* normalize pncs: we need the true case to jump into the
continue;
/* normalize pncs: we need the true case to jump into the
- * common block */
+ * common block
(ie. conjunctive normal form)
*/
irg = current_ir_graph;
if(get_Proj_proj(lower_cf) == pn_Cond_false) {
if(cpair.proj_lo == cond_selector) {
irg = current_ir_graph;
if(get_Proj_proj(lower_cf) == pn_Cond_false) {
if(cpair.proj_lo == cond_selector) {
@@
-421,7
+426,7
@@
void opt_bool(ir_graph *const irg)
{
irg_walk_graph(irg, NULL, bool_walk, NULL);
{
irg_walk_graph(irg, NULL, bool_walk, NULL);
-
set_using_block_mark(irg
);
+
ir_reserve_resources(irg, IR_RESOURCE_BLOCK_MARK
);
irg_walk_graph(irg, clear_block_infos, collect_phis, NULL);
irg_walk_graph(irg, clear_block_infos, collect_phis, NULL);
@@
-432,5
+437,5
@@
void opt_bool(ir_graph *const irg)
set_irg_extblk_inconsistent(irg);
set_irg_loopinfo_inconsistent(irg);
set_irg_extblk_inconsistent(irg);
set_irg_loopinfo_inconsistent(irg);
-
clear_using_block_mark(irg
);
+
ir_free_resources(irg, IR_RESOURCE_BLOCK_MARK
);
}
}