summaryrefslogtreecommitdiff
path: root/compiler/optimizing/superblock_cloner.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/superblock_cloner.cc')
-rw-r--r--compiler/optimizing/superblock_cloner.cc42
1 files changed, 28 insertions, 14 deletions
diff --git a/compiler/optimizing/superblock_cloner.cc b/compiler/optimizing/superblock_cloner.cc
index 7c0097c6f6..f323c8af2d 100644
--- a/compiler/optimizing/superblock_cloner.cc
+++ b/compiler/optimizing/superblock_cloner.cc
@@ -175,8 +175,10 @@ void SuperblockCloner::RemapOrigInternalOrIncomingEdge(HBasicBlock* orig_block,
// of copy successor's predecessors.
bool first_phi_met = false;
for (HInstructionIterator it(orig_succ->GetPhis()); !it.Done(); it.Advance()) {
- HPhi* orig_phi = it.Current()->AsPhi();
- HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* orig_phi = it.Current()->AsPhiOrNull();
+ // TODO: Remove "OrNull".
+ HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhiOrNull();
HInstruction* orig_phi_input = orig_phi->InputAt(this_index);
// Remove corresponding input for original phi.
orig_phi->RemoveInputAt(this_index);
@@ -205,8 +207,10 @@ void SuperblockCloner::AddCopyInternalEdge(HBasicBlock* orig_block,
size_t orig_index = orig_succ->GetPredecessorIndexOf(orig_block);
for (HInstructionIterator it(orig_succ->GetPhis()); !it.Done(); it.Advance()) {
- HPhi* orig_phi = it.Current()->AsPhi();
- HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* orig_phi = it.Current()->AsPhiOrNull();
+ // TODO: Remove "OrNull".
+ HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhiOrNull();
HInstruction* orig_phi_input = orig_phi->InputAt(orig_index);
copy_phi->AddInput(orig_phi_input);
}
@@ -221,7 +225,8 @@ void SuperblockCloner::RemapCopyInternalEdge(HBasicBlock* orig_block,
size_t orig_index = orig_succ->GetPredecessorIndexOf(orig_block);
for (HInstructionIterator it(orig_succ->GetPhis()); !it.Done(); it.Advance()) {
- HPhi* orig_phi = it.Current()->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* orig_phi = it.Current()->AsPhiOrNull();
HInstruction* orig_phi_input = orig_phi->InputAt(orig_index);
orig_phi->AddInput(orig_phi_input);
}
@@ -249,8 +254,10 @@ void SuperblockCloner::CopyIncomingEdgesForVersioning() {
// TODO: remove this requirement.
DCHECK_EQ(orig_block->GetPredecessorIndexOf(orig_pred), incoming_edge_count);
for (HInstructionIterator it(orig_block->GetPhis()); !it.Done(); it.Advance()) {
- HPhi* orig_phi = it.Current()->AsPhi();
- HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* orig_phi = it.Current()->AsPhiOrNull();
+ // TODO: Remove "OrNull".
+ HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhiOrNull();
HInstruction* orig_phi_input = orig_phi->InputAt(incoming_edge_count);
// Add the corresponding input of the original phi to the copy one.
copy_phi->AddInput(orig_phi_input);
@@ -547,8 +554,10 @@ void SuperblockCloner::ResolveDataFlow() {
HBasicBlock* orig_block = entry.first;
for (HInstructionIterator it(orig_block->GetPhis()); !it.Done(); it.Advance()) {
- HPhi* orig_phi = it.Current()->AsPhi();
- HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* orig_phi = it.Current()->AsPhiOrNull();
+ // TODO: Remove "OrNull".
+ HPhi* copy_phi = GetInstrCopy(orig_phi)->AsPhiOrNull();
ResolvePhi(orig_phi);
ResolvePhi(copy_phi);
}
@@ -669,7 +678,8 @@ void SuperblockCloner::FixSubgraphClosedSSAAfterCloning() {
for (auto it : live_outs_) {
DCHECK(it.first != it.second);
HInstruction* orig_value = it.first;
- HPhi* phi = it.second->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* phi = it.second->AsPhiOrNull();
HInstruction* copy_value = GetInstrCopy(orig_value);
// Copy edges are inserted after the original so we can just add new input to the phi.
phi->AddInput(copy_value);
@@ -1001,7 +1011,8 @@ void SuperblockCloner::CleanUp() {
for (auto entry : *bb_map_) {
HBasicBlock* orig_block = entry.first;
for (HInstructionIterator inst_it(orig_block->GetPhis()); !inst_it.Done(); inst_it.Advance()) {
- HPhi* phi = inst_it.Current()->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* phi = inst_it.Current()->AsPhiOrNull();
if (ArePhiInputsTheSame(phi)) {
phi->ReplaceWith(phi->InputAt(0));
orig_block->RemovePhi(phi);
@@ -1010,7 +1021,8 @@ void SuperblockCloner::CleanUp() {
HBasicBlock* copy_block = GetBlockCopy(orig_block);
for (HInstructionIterator inst_it(copy_block->GetPhis()); !inst_it.Done(); inst_it.Advance()) {
- HPhi* phi = inst_it.Current()->AsPhi();
+ // TODO: Remove "OrNull".
+ HPhi* phi = inst_it.Current()->AsPhiOrNull();
if (ArePhiInputsTheSame(phi)) {
phi->ReplaceWith(phi->InputAt(0));
copy_block->RemovePhi(phi);
@@ -1032,8 +1044,10 @@ HBasicBlock* SuperblockCloner::CloneBasicBlock(const HBasicBlock* orig_block) {
for (HInstructionIterator it(orig_block->GetPhis()); !it.Done(); it.Advance()) {
HInstruction* orig_instr = it.Current();
HInstruction* copy_instr = orig_instr->Clone(arena_);
- copy_block->AddPhi(copy_instr->AsPhi());
- copy_instr->AsPhi()->RemoveAllInputs();
+ // TODO: Remove "OrNull".
+ copy_block->AddPhi(copy_instr->AsPhiOrNull());
+ // TODO: Remove "OrNull".
+ copy_instr->AsPhiOrNull()->RemoveAllInputs();
DCHECK(!orig_instr->HasEnvironment());
hir_map_->Put(orig_instr, copy_instr);
}