Index: src/compiler/node-matchers.h |
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h |
index c317fdd5e7b5edd17f0fc0be056062034d47f6e1..d2bdb8bff5bdbe3ede04eefbf5fb667c0e5892f9 100644 |
--- a/src/compiler/node-matchers.h |
+++ b/src/compiler/node-matchers.h |
@@ -489,13 +489,14 @@ struct BaseWithIndexAndDisplacementMatcher { |
bool power_of_two_plus_one = false; |
DisplacementMode displacement_mode = kPositiveDisplacement; |
int scale = 0; |
- if (m.HasIndexInput() && left->OwnedBy(node)) { |
+ if (m.HasIndexInput() && left->OwnedByAddressingOperand()) { |
index = m.IndexInput(); |
scale = m.scale(); |
scale_expression = left; |
power_of_two_plus_one = m.power_of_two_plus_one(); |
bool match_found = false; |
- if (right->opcode() == AddMatcher::kSubOpcode && right->OwnedBy(node)) { |
+ if (right->opcode() == AddMatcher::kSubOpcode && |
+ right->OwnedByAddressingOperand()) { |
AddMatcher right_matcher(right); |
if (right_matcher.right().HasValue()) { |
// (S + (B - D)) |
@@ -506,7 +507,8 @@ struct BaseWithIndexAndDisplacementMatcher { |
} |
} |
if (!match_found) { |
- if (right->opcode() == AddMatcher::kAddOpcode && right->OwnedBy(node)) { |
+ if (right->opcode() == AddMatcher::kAddOpcode && |
+ right->OwnedByAddressingOperand()) { |
AddMatcher right_matcher(right); |
if (right_matcher.right().HasValue()) { |
// (S + (B + D)) |
@@ -526,7 +528,8 @@ struct BaseWithIndexAndDisplacementMatcher { |
} |
} else { |
bool match_found = false; |
- if (left->opcode() == AddMatcher::kSubOpcode && left->OwnedBy(node)) { |
+ if (left->opcode() == AddMatcher::kSubOpcode && |
+ left->OwnedByAddressingOperand()) { |
AddMatcher left_matcher(left); |
Node* left_left = left_matcher.left().node(); |
Node* left_right = left_matcher.right().node(); |
@@ -551,7 +554,8 @@ struct BaseWithIndexAndDisplacementMatcher { |
} |
} |
if (!match_found) { |
- if (left->opcode() == AddMatcher::kAddOpcode && left->OwnedBy(node)) { |
+ if (left->opcode() == AddMatcher::kAddOpcode && |
+ left->OwnedByAddressingOperand()) { |
AddMatcher left_matcher(left); |
Node* left_left = left_matcher.left().node(); |
Node* left_right = left_matcher.right().node(); |
@@ -565,13 +569,19 @@ struct BaseWithIndexAndDisplacementMatcher { |
displacement = left_right; |
base = right; |
} else if (m.right().HasValue()) { |
- // ((S + B) + D) |
- index = left_matcher.IndexInput(); |
- scale = left_matcher.scale(); |
- scale_expression = left_left; |
- power_of_two_plus_one = left_matcher.power_of_two_plus_one(); |
- base = left_right; |
- displacement = right; |
+ if (left->OwnedBy(node)) { |
+ // ((S + B) + D) |
+ index = left_matcher.IndexInput(); |
+ scale = left_matcher.scale(); |
+ scale_expression = left_left; |
+ power_of_two_plus_one = left_matcher.power_of_two_plus_one(); |
+ base = left_right; |
+ displacement = right; |
+ } else { |
+ // (B + D) |
+ base = left; |
+ displacement = right; |
+ } |
} else { |
// (B + B) |
index = left; |
@@ -584,10 +594,16 @@ struct BaseWithIndexAndDisplacementMatcher { |
displacement = left_right; |
base = right; |
} else if (m.right().HasValue()) { |
- // ((B + B) + D) |
- index = left_left; |
- base = left_right; |
- displacement = right; |
+ if (left->OwnedBy(node)) { |
+ // ((B + B) + D) |
+ index = left_left; |
+ base = left_right; |
+ displacement = right; |
+ } else { |
+ // (B + D) |
+ base = left; |
+ displacement = right; |
+ } |
} else { |
// (B + B) |
index = left; |