Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/compiler/common-operator-reducer.cc

Issue 1218443002: [turbofan] Also update the BranchHint when merging a BooleanNot. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/common-operator-reducer.h" 5 #include "src/compiler/common-operator-reducer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 use->set_op(common()->IfTrue()); 92 use->set_op(common()->IfTrue());
93 break; 93 break;
94 default: 94 default:
95 UNREACHABLE(); 95 UNREACHABLE();
96 } 96 }
97 } 97 }
98 // Update the condition of {branch}. No need to mark the uses for revisit, 98 // Update the condition of {branch}. No need to mark the uses for revisit,
99 // since we tell the graph reducer that the {branch} was changed and the 99 // since we tell the graph reducer that the {branch} was changed and the
100 // graph reduction logic will ensure that the uses are revisited properly. 100 // graph reduction logic will ensure that the uses are revisited properly.
101 node->ReplaceInput(0, cond->InputAt(0)); 101 node->ReplaceInput(0, cond->InputAt(0));
102 // Negative the hint for {branch}.
Sven Panne 2015/06/26 11:40:56 Why do we need the switch at all? Isn't the simple
Benedikt Meurer 2015/06/26 11:43:40 Done.
103 switch (BranchHintOf(node->op())) {
104 case BranchHint::kTrue:
105 node->set_op(common()->Branch(BranchHint::kFalse));
106 break;
107 case BranchHint::kFalse:
108 node->set_op(common()->Branch(BranchHint::kTrue));
109 break;
110 case BranchHint::kNone:
111 break;
112 }
102 return Changed(node); 113 return Changed(node);
103 } 114 }
104 Decision const decision = DecideCondition(cond); 115 Decision const decision = DecideCondition(cond);
105 if (decision == Decision::kUnknown) return NoChange(); 116 if (decision == Decision::kUnknown) return NoChange();
106 Node* const control = node->InputAt(1); 117 Node* const control = node->InputAt(1);
107 for (Node* const use : node->uses()) { 118 for (Node* const use : node->uses()) {
108 switch (use->opcode()) { 119 switch (use->opcode()) {
109 case IrOpcode::kIfTrue: 120 case IrOpcode::kIfTrue:
110 Replace(use, (decision == Decision::kTrue) ? control : dead()); 121 Replace(use, (decision == Decision::kTrue) ? control : dead());
111 break; 122 break;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 node->set_op(op); 383 node->set_op(op);
373 node->ReplaceInput(0, a); 384 node->ReplaceInput(0, a);
374 node->ReplaceInput(1, b); 385 node->ReplaceInput(1, b);
375 node->TrimInputCount(2); 386 node->TrimInputCount(2);
376 return Changed(node); 387 return Changed(node);
377 } 388 }
378 389
379 } // namespace compiler 390 } // namespace compiler
380 } // namespace internal 391 } // namespace internal
381 } // namespace v8 392 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.h ('k') | test/unittests/compiler/common-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698