提交 c72f307a 编写于 作者: N never

6680594: Load + Load isn't canonicalized leading to missed GVN opportunities

Reviewed-by: kvn, jrose
上级 c4a97731
...@@ -70,9 +70,14 @@ static bool commute( Node *add, int con_left, int con_right ) { ...@@ -70,9 +70,14 @@ static bool commute( Node *add, int con_left, int con_right ) {
// Convert "Load+x" into "x+Load". // Convert "Load+x" into "x+Load".
// Now check for loads // Now check for loads
if( in2->is_Load() ) return false; if (in2->is_Load()) {
// Left is a Load and Right is not; move it right. if (!in1->is_Load()) {
if( in1->is_Load() ) { // already x+Load to return
return false;
}
// both are loads, so fall through to sort inputs by idx
} else if( in1->is_Load() ) {
// Left is a Load and Right is not; move it right.
add->swap_edges(1, 2); add->swap_edges(1, 2);
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册