summaryrefslogtreecommitdiff
path: root/compiler/optimizing/induction_var_analysis.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/induction_var_analysis.cc')
-rw-r--r--compiler/optimizing/induction_var_analysis.cc40
1 files changed, 14 insertions, 26 deletions
diff --git a/compiler/optimizing/induction_var_analysis.cc b/compiler/optimizing/induction_var_analysis.cc
index e54d12b931..be6c268f5d 100644
--- a/compiler/optimizing/induction_var_analysis.cc
+++ b/compiler/optimizing/induction_var_analysis.cc
@@ -89,14 +89,12 @@ static bool IsGuardedBy(const HLoopInformation* loop,
if (!control->IsIf()) {
return false;
}
- // TODO: Remove "OrNull".
- HIf* ifs = control->AsIfOrNull();
+ HIf* ifs = control->AsIf();
HInstruction* if_expr = ifs->InputAt(0);
if (if_expr->IsCondition()) {
- // TODO: Remove "OrNull".
IfCondition other_cmp = ifs->IfTrueSuccessor() == entry
- ? if_expr->AsConditionOrNull()->GetCondition()
- : if_expr->AsConditionOrNull()->GetOppositeCondition();
+ ? if_expr->AsCondition()->GetCondition()
+ : if_expr->AsCondition()->GetOppositeCondition();
if (if_expr->InputAt(0) == a && if_expr->InputAt(1) == b) {
return cmp == other_cmp;
} else if (if_expr->InputAt(1) == a && if_expr->InputAt(0) == b) {
@@ -437,10 +435,9 @@ void HInductionVarAnalysis::ClassifyTrivial(const HLoopInformation* loop,
} else if (instruction->IsSelect()) {
info = TransferPhi(loop, instruction, /*input_index*/ 0, /*adjust_input_size*/ 1);
} else if (instruction->IsTypeConversion()) {
- // TODO: Remove "OrNull".
info = TransferConversion(LookupInfo(loop, instruction->InputAt(0)),
- instruction->AsTypeConversionOrNull()->GetInputType(),
- instruction->AsTypeConversionOrNull()->GetResultType());
+ instruction->AsTypeConversion()->GetInputType(),
+ instruction->AsTypeConversion()->GetResultType());
} else if (instruction->IsBoundsCheck()) {
info = LookupInfo(loop, instruction->InputAt(0)); // Pass-through.
}
@@ -476,8 +473,7 @@ void HInductionVarAnalysis::ClassifyNonTrivial(const HLoopInformation* loop,
// Store interesting cycle in each loop phi.
for (size_t i = 0; i < size; i++) {
if (scc[i]->IsLoopHeaderPhi()) {
- // TODO: Remove "OrNull".
- AssignCycle(scc[i]->AsPhiOrNull(), ArrayRef<HInstruction* const>(scc));
+ AssignCycle(scc[i]->AsPhi(), ArrayRef<HInstruction* const>(scc));
}
}
@@ -552,8 +548,7 @@ void HInductionVarAnalysis::ClassifyNonTrivial(const HLoopInformation* loop,
// Select acts like Phi.
update = SolvePhi(instruction, /*input_index=*/ 0, /*adjust_input_size=*/ 1, cycle);
} else if (instruction->IsTypeConversion()) {
- // TODO: Remove "OrNull".
- update = SolveConversion(loop, phi, instruction->AsTypeConversionOrNull(), cycle, &type);
+ update = SolveConversion(loop, phi, instruction->AsTypeConversion(), cycle, &type);
}
if (update == nullptr) {
return;
@@ -1003,8 +998,7 @@ HInductionVarAnalysis::InductionInfo* HInductionVarAnalysis::SolveConversion(
void HInductionVarAnalysis::VisitControl(const HLoopInformation* loop) {
HInstruction* control = loop->GetHeader()->GetLastInstruction();
if (control->IsIf()) {
- // TODO: Remove "OrNull".
- HIf* ifs = control->AsIfOrNull();
+ HIf* ifs = control->AsIf();
HBasicBlock* if_true = ifs->IfTrueSuccessor();
HBasicBlock* if_false = ifs->IfFalseSuccessor();
HInstruction* if_expr = ifs->InputAt(0);
@@ -1012,8 +1006,7 @@ void HInductionVarAnalysis::VisitControl(const HLoopInformation* loop) {
// loop-header: ....
// if (condition) goto X
if (if_expr->IsCondition()) {
- // TODO: Remove "OrNull".
- HCondition* condition = if_expr->AsConditionOrNull();
+ HCondition* condition = if_expr->AsCondition();
const HBasicBlock* context = condition->GetBlock();
InductionInfo* a = LookupInfo(loop, condition->InputAt(0));
InductionInfo* b = LookupInfo(loop, condition->InputAt(1));
@@ -1259,8 +1252,7 @@ bool HInductionVarAnalysis::RewriteBreakLoop(const HBasicBlock* context,
return false;
}
// Simple terminating i != U condition, used nowhere else.
- // TODO: Remove "OrNull".
- HIf* ifs = loop->GetHeader()->GetLastInstruction()->AsIfOrNull();
+ HIf* ifs = loop->GetHeader()->GetLastInstruction()->AsIf();
HInstruction* cond = ifs->InputAt(0);
if (ifs->GetPrevious() != cond || !cond->HasOnlyOneNonEnvironmentUse()) {
return false;
@@ -1523,11 +1515,9 @@ bool HInductionVarAnalysis::InductionEqual(InductionInfo* info1,
std::string HInductionVarAnalysis::FetchToString(HInstruction* fetch) {
DCHECK(fetch != nullptr);
if (fetch->IsIntConstant()) {
- // TODO: Remove "OrNull".
- return std::to_string(fetch->AsIntConstantOrNull()->GetValue());
+ return std::to_string(fetch->AsIntConstant()->GetValue());
} else if (fetch->IsLongConstant()) {
- // TODO: Remove "OrNull".
- return std::to_string(fetch->AsLongConstantOrNull()->GetValue());
+ return std::to_string(fetch->AsLongConstant()->GetValue());
}
return std::to_string(fetch->GetId()) + ":" + fetch->DebugName();
}
@@ -1619,8 +1609,7 @@ void HInductionVarAnalysis::CalculateLoopHeaderPhisInARow(
// If the input is not a loop header phi, we only have 1 (current_phi).
int current_value = 1;
if (current_phi->InputAt(index)->IsLoopHeaderPhi()) {
- // TODO: Remove "OrNull".
- HPhi* loop_header_phi = current_phi->InputAt(index)->AsPhiOrNull();
+ HPhi* loop_header_phi = current_phi->InputAt(index)->AsPhi();
auto it = cached_values.find(loop_header_phi);
if (it != cached_values.end()) {
current_value += it->second;
@@ -1661,8 +1650,7 @@ bool HInductionVarAnalysis::IsPathologicalCase() {
for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
DCHECK(it.Current()->IsLoopHeaderPhi());
- // TODO: Remove "OrNull".
- HPhi* phi = it.Current()->AsPhiOrNull();
+ HPhi* phi = it.Current()->AsPhi();
CalculateLoopHeaderPhisInARow(phi, cached_values, local_allocator);
DCHECK(cached_values.find(phi) != cached_values.end())
<< " we should have a value for Phi " << phi->GetId()