提交 05a2e641 编写于 作者: N never

6697236: missing Identity for "(X+Y) - X" into Y

Reviewed-by: kvn
上级 851ac153
......@@ -45,10 +45,13 @@ Node *SubNode::Identity( PhaseTransform *phase ) {
return in(2)->in(2);
}
// Convert "(X+Y) - Y" into X
// Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y
if( in(1)->Opcode() == Op_AddI ) {
if( phase->eqv(in(1)->in(2),in(2)) )
return in(1)->in(1);
if (phase->eqv(in(1)->in(1),in(2)))
return in(1)->in(2);
// Also catch: "(X + Opaque2(Y)) - Y". In this case, 'Y' is a loop-varying
// trip counter and X is likely to be loop-invariant (that's how O2 Nodes
// are originally used, although the optimizer sometimes jiggers things).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册