diff options
| author | 2017-06-26 12:40:41 +0000 | |
|---|---|---|
| committer | 2017-06-26 12:40:44 +0000 | |
| commit | 3b9aee84472d9b45fef8654de875463c14c5fbcf (patch) | |
| tree | 611a00f8f9d7526adcafdac6bac929cb80bf1309 /compiler | |
| parent | d1c983a5bc3ae50eab3af405ae8a415e1f36f532 (diff) | |
| parent | 6fda42718a348cfb758d8714e223cab7e855765b (diff) | |
Merge "Fix braino when handling branches fallthrough in arm backend."
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 9 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 7 | ||||
| -rw-r--r-- | compiler/optimizing/code_generator_arm_vixl.cc | 9 |
3 files changed, 16 insertions, 9 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 0b3ac204ff..6b9f232e8f 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -2875,21 +2875,28 @@ void InstructionCodeGeneratorARM::GenerateCompareTestAndBranch(HCondition* condi if (CanGenerateTest(condition, codegen_->GetAssembler())) { Label* non_fallthrough_target; bool invert; + bool emit_both_branches; if (true_target_in == nullptr) { + // The true target is fallthrough. DCHECK(false_target_in != nullptr); non_fallthrough_target = false_target_in; invert = true; + emit_both_branches = false; } else { + // Either the false target is fallthrough, or there is no fallthrough + // and both branches must be emitted. non_fallthrough_target = true_target_in; invert = false; + emit_both_branches = (false_target_in != nullptr); } const auto cond = GenerateTest(condition, invert, codegen_); __ b(non_fallthrough_target, cond.first); - if (false_target_in != nullptr && false_target_in != non_fallthrough_target) { + if (emit_both_branches) { + // No target falls through, we need to branch. __ b(false_target_in); } diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 34397e66bc..2561ed0762 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -3608,9 +3608,6 @@ void InstructionCodeGeneratorARM64::GenerateTestAndBranch(HInstruction* instruct size_t condition_input_index, vixl::aarch64::Label* true_target, vixl::aarch64::Label* false_target) { - // FP branching requires both targets to be explicit. If either of the targets - // is nullptr (fallthrough) use and bind `fallthrough_target` instead. - vixl::aarch64::Label fallthrough_target; HInstruction* cond = instruction->InputAt(condition_input_index); if (true_target == nullptr && false_target == nullptr) { @@ -3711,10 +3708,6 @@ void InstructionCodeGeneratorARM64::GenerateTestAndBranch(HInstruction* instruct if (true_target != nullptr && false_target != nullptr) { __ B(false_target); } - - if (fallthrough_target.IsLinked()) { - __ Bind(&fallthrough_target); - } } void LocationsBuilderARM64::VisitIf(HIf* if_instr) { diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc index a8b00c358b..9a2402be04 100644 --- a/compiler/optimizing/code_generator_arm_vixl.cc +++ b/compiler/optimizing/code_generator_arm_vixl.cc @@ -2964,21 +2964,28 @@ void InstructionCodeGeneratorARMVIXL::GenerateCompareTestAndBranch(HCondition* c if (CanGenerateTest(condition, codegen_->GetAssembler())) { vixl32::Label* non_fallthrough_target; bool invert; + bool emit_both_branches; if (true_target_in == nullptr) { + // The true target is fallthrough. DCHECK(false_target_in != nullptr); non_fallthrough_target = false_target_in; invert = true; + emit_both_branches = false; } else { non_fallthrough_target = true_target_in; invert = false; + // Either the false target is fallthrough, or there is no fallthrough + // and both branches must be emitted. + emit_both_branches = (false_target_in != nullptr); } const auto cond = GenerateTest(condition, invert, codegen_); __ B(cond.first, non_fallthrough_target, is_far_target); - if (false_target_in != nullptr && false_target_in != non_fallthrough_target) { + if (emit_both_branches) { + // No target falls through, we need to branch. __ B(false_target_in); } |