Commit 23ac3b3f authored by yb9976's avatar yb9976
Browse files

Added local optimizations: (a & X) | a = a | (a & X) = a.

parent ac1ff305
...@@ -1168,6 +1168,19 @@ static ir_node *equivalent_node_Or(ir_node *n) ...@@ -1168,6 +1168,19 @@ static ir_node *equivalent_node_Or(ir_node *n)
return n; return n;
} }
/* (a & X) | a => a */
if (is_And(a) && get_commutative_other_op(a, b)) {
n = b;
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_OR);
return n;
}
/* a | (a & X) => a */
if (is_And(b) && get_commutative_other_op(b, a)) {
n = a;
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_OR);
return n;
}
return n; return n;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment