diff options
Diffstat (limited to 'compiler/optimizing')
| -rw-r--r-- | compiler/optimizing/instruction_simplifier.cc | 11 | ||||
| -rw-r--r-- | compiler/optimizing/reference_type_propagation.cc | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 011983fb70..eb1d1560db 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -250,6 +250,7 @@ void InstructionSimplifierVisitor::VisitShift(HBinaryOperation* instruction) { // src instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); } } } @@ -278,6 +279,7 @@ bool InstructionSimplifierVisitor::ReplaceRotateWithRor(HBinaryOperation* op, if (!shl->GetRight()->HasUses()) { shl->GetRight()->GetBlock()->RemoveInstruction(shl->GetRight()); } + RecordSimplification(); return true; } @@ -907,6 +909,7 @@ void InstructionSimplifierVisitor::VisitAdd(HAdd* instruction) { if (Primitive::IsIntegralType(instruction->GetType())) { instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } } @@ -999,6 +1002,7 @@ void InstructionSimplifierVisitor::VisitAnd(HAnd* instruction) { // src instruction->ReplaceWith(instruction->GetLeft()); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1116,6 +1120,7 @@ void InstructionSimplifierVisitor::VisitDiv(HDiv* instruction) { // src instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1176,6 +1181,7 @@ void InstructionSimplifierVisitor::VisitMul(HMul* instruction) { // src instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1216,6 +1222,7 @@ void InstructionSimplifierVisitor::VisitMul(HMul* instruction) { // 0 instruction->ReplaceWith(input_cst); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); } else if (IsPowerOfTwo(factor)) { // Replace code looking like // MUL dst, src, pow_of_2 @@ -1334,6 +1341,7 @@ void InstructionSimplifierVisitor::VisitOr(HOr* instruction) { // src instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1347,6 +1355,7 @@ void InstructionSimplifierVisitor::VisitOr(HOr* instruction) { // src instruction->ReplaceWith(instruction->GetLeft()); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1382,6 +1391,7 @@ void InstructionSimplifierVisitor::VisitSub(HSub* instruction) { // yields `-0.0`. instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } @@ -1460,6 +1470,7 @@ void InstructionSimplifierVisitor::VisitXor(HXor* instruction) { // src instruction->ReplaceWith(input_other); instruction->GetBlock()->RemoveInstruction(instruction); + RecordSimplification(); return; } diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index 9c3a719a01..2a281dd46d 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -809,7 +809,11 @@ void ReferenceTypePropagation::UpdateBoundType(HBoundType* instr) { // Make sure that we don't go over the bounded type. ReferenceTypeInfo upper_bound_rti = instr->GetUpperBound(); if (!upper_bound_rti.IsSupertypeOf(new_rti)) { - new_rti = upper_bound_rti; + // Note that the input might be exact, in which case we know the branch leading + // to the bound type is dead. We play it safe by not marking the bound type as + // exact. + bool is_exact = upper_bound_rti.GetTypeHandle()->CannotBeAssignedFromOtherTypes(); + new_rti = ReferenceTypeInfo::Create(upper_bound_rti.GetTypeHandle(), is_exact); } instr->SetReferenceTypeInfo(new_rti); } |