@@ -30,27 +30,27 @@ static bool PhiHasSingleUse(PhiInstr* phi, Value* use) {
3030}
3131
3232bool BranchSimplifier::Match (JoinEntryInstr* block) {
33- // Match the pattern of a branch on a comparison whose left operand is a
33+ // Match the pattern of a branch on a condition whose left operand is a
3434 // phi from the same block, and whose right operand is a constant.
3535 //
36- // Branch(Comparison (kind, Phi, Constant))
36+ // Branch(Condition (kind, Phi, Constant))
3737 //
3838 // These are the branches produced by inlining in a test context. Also,
3939 // the phi has no other uses so they can simply be eliminated. The block
4040 // has no other phis and no instructions intervening between the phi and
4141 // branch so the block can simply be eliminated.
4242 BranchInstr* branch = block->last_instruction ()->AsBranch ();
4343 ASSERT (branch != nullptr );
44- ComparisonInstr* comparison = branch->comparison ();
45- if (comparison ->InputCount () != 2 ) {
44+ ConditionInstr* condition = branch->condition ();
45+ if (condition ->InputCount () != 2 ) {
4646 return false ;
4747 }
48- if (comparison ->CanDeoptimize () || comparison ->MayThrow ()) {
48+ if (condition ->CanDeoptimize () || condition ->MayThrow ()) {
4949 return false ;
5050 }
51- Value* left = comparison-> left ( );
51+ Value* left = condition-> InputAt ( 0 );
5252 PhiInstr* phi = left->definition ()->AsPhi ();
53- Value* right = comparison-> right ( );
53+ Value* right = condition-> InputAt ( 1 );
5454 ConstantInstr* constant =
5555 (right == nullptr ) ? nullptr : right->definition ()->AsConstant ();
5656 return (phi != nullptr ) && (constant != nullptr ) &&
@@ -87,11 +87,11 @@ BranchInstr* BranchSimplifier::CloneBranch(Zone* zone,
8787 BranchInstr* branch,
8888 Value* new_left,
8989 Value* new_right) {
90- ComparisonInstr* comparison = branch->comparison ();
91- ComparisonInstr* new_comparison =
92- comparison ->CopyWithNewOperands (new_left, new_right);
90+ ConditionInstr* condition = branch->condition ();
91+ ConditionInstr* new_condition =
92+ condition ->CopyWithNewOperands (new_left, new_right);
9393 BranchInstr* new_branch =
94- new (zone) BranchInstr (new_comparison , DeoptId::kNone );
94+ new (zone) BranchInstr (new_condition , DeoptId::kNone );
9595 return new_branch;
9696}
9797
@@ -140,9 +140,10 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
140140 JoinEntryInstr* join_true = ToJoinEntry (zone, branch->true_successor ());
141141 JoinEntryInstr* join_false = ToJoinEntry (zone, branch->false_successor ());
142142
143- ComparisonInstr* comparison = branch->comparison ();
144- PhiInstr* phi = comparison->left ()->definition ()->AsPhi ();
145- ConstantInstr* constant = comparison->right ()->definition ()->AsConstant ();
143+ ConditionInstr* condition = branch->condition ();
144+ PhiInstr* phi = condition->InputAt (0 )->definition ()->AsPhi ();
145+ ConstantInstr* constant =
146+ condition->InputAt (1 )->definition ()->AsConstant ();
146147 ASSERT (constant != nullptr );
147148 // Copy the constant and branch and push it to all the predecessors.
148149 for (intptr_t i = 0 , count = block->PredecessorCount (); i < count; ++i) {
@@ -161,10 +162,10 @@ void BranchSimplifier::Simplify(FlowGraph* flow_graph) {
161162 } else {
162163 // Take the environment from the branch if it has one.
163164 new_branch->InheritDeoptTarget (zone, branch);
164- // InheritDeoptTarget gave the new branch's comparison the same
165+ // InheritDeoptTarget gave the new branch's condition the same
165166 // deopt id that it gave the new branch. The id should be the
166- // deopt id of the original comparison .
167- new_branch->comparison ()->SetDeoptId (*comparison );
167+ // deopt id of the original condition .
168+ new_branch->condition ()->SetDeoptId (*condition );
168169 // The phi can be used in the branch's environment. Rename such
169170 // uses.
170171 Definition* replacement = phi->InputAt (i)->definition ();
@@ -249,11 +250,11 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
249250 JoinEntryInstr* join = block->AsJoinEntry ();
250251
251252 // Detect diamond control flow pattern which materializes a value depending
252- // on the result of the comparison :
253+ // on the result of the condition :
253254 //
254255 // B_pred:
255256 // ...
256- // Branch if COMP goto (B_pred1, B_pred2)
257+ // Branch if COND goto (B_pred1, B_pred2)
257258 // B_pred1: -- trivial block that contains at most one definition
258259 // v1 = Constant(...)
259260 // goto B_block
@@ -266,7 +267,7 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
266267 // and replace it with
267268 //
268269 // Ba:
269- // v3 = IfThenElse(COMP ? v1 : v2)
270+ // v3 = IfThenElse(COND ? v1 : v2)
270271 //
271272 if ((join != nullptr ) && (join->phis () != nullptr ) &&
272273 (join->phis ()->length () == 1 ) && (block->PredecessorCount () == 2 )) {
@@ -291,19 +292,20 @@ void IfConverter::Simplify(FlowGraph* flow_graph) {
291292 continue ;
292293 }
293294
294- ComparisonInstr* comparison = branch->comparison ();
295+ ConditionInstr* condition = branch->condition ();
295296
296297 // Check if the platform supports efficient branchless IfThenElseInstr
297- // for the given combination of comparison and values flowing from
298+ // for the given combination of condition and values flowing from
298299 // false and true paths.
299- if (IfThenElseInstr::Supports (comparison , v1, v2)) {
300+ if (IfThenElseInstr::Supports (condition , v1, v2)) {
300301 Value* if_true = (pred1 == branch->true_successor ()) ? v1 : v2;
301302 Value* if_false = (pred2 == branch->true_successor ()) ? v1 : v2;
302303
303- ComparisonInstr* new_comparison = comparison->CopyWithNewOperands (
304- comparison->left ()->Copy (zone), comparison->right ()->Copy (zone));
304+ ConditionInstr* new_condition =
305+ condition->CopyWithNewOperands (condition->InputAt (0 )->Copy (zone),
306+ condition->InputAt (1 )->Copy (zone));
305307 IfThenElseInstr* if_then_else =
306- new (zone) IfThenElseInstr (new_comparison , if_true->Copy (zone),
308+ new (zone) IfThenElseInstr (new_condition , if_true->Copy (zone),
307309 if_false->Copy (zone), DeoptId::kNone );
308310 flow_graph->InsertBefore (branch, if_then_else, nullptr ,
309311 FlowGraph::kValue );
0 commit comments