ssa_builder.cc revision 51d400d4ebd41b9fb4d67ac3179f8fb66a090fdd
1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "ssa_builder.h"
18
19#include "nodes.h"
20#include "primitive_type_propagation.h"
21#include "ssa_phi_elimination.h"
22
23namespace art {
24
25/**
26 * A debuggable application may require to reviving phis, to ensure their
27 * associated DEX register is available to a debugger. This class implements
28 * the logic for statement (c) of the SsaBuilder (see ssa_builder.h). It
29 * also makes sure that phis with incompatible input types are not revived
30 * (statement (b) of the SsaBuilder).
31 *
32 * This phase must be run after detecting dead phis through the
33 * DeadPhiElimination phase, and before deleting the dead phis.
34 */
35class DeadPhiHandling : public ValueObject {
36 public:
37  explicit DeadPhiHandling(HGraph* graph)
38      : graph_(graph), worklist_(graph->GetArena(), kDefaultWorklistSize) {}
39
40  void Run();
41
42 private:
43  void VisitBasicBlock(HBasicBlock* block);
44  void ProcessWorklist();
45  void AddToWorklist(HPhi* phi);
46  void AddDependentInstructionsToWorklist(HPhi* phi);
47  bool UpdateType(HPhi* phi);
48
49  HGraph* const graph_;
50  GrowableArray<HPhi*> worklist_;
51
52  static constexpr size_t kDefaultWorklistSize = 8;
53
54  DISALLOW_COPY_AND_ASSIGN(DeadPhiHandling);
55};
56
57bool DeadPhiHandling::UpdateType(HPhi* phi) {
58  Primitive::Type existing = phi->GetType();
59  DCHECK(phi->IsLive());
60
61  bool conflict = false;
62  Primitive::Type new_type = existing;
63  for (size_t i = 0, e = phi->InputCount(); i < e; ++i) {
64    HInstruction* input = phi->InputAt(i);
65    if (input->IsPhi() && input->AsPhi()->IsDead()) {
66      // We are doing a reverse post order visit of the graph, reviving
67      // phis that have environment uses and updating their types. If an
68      // input is a phi, and it is dead (because its input types are
69      // conflicting), this phi must be marked dead as well.
70      conflict = true;
71      break;
72    }
73    Primitive::Type input_type = HPhi::ToPhiType(input->GetType());
74
75    // The only acceptable transitions are:
76    // - From void to typed: first time we update the type of this phi.
77    // - From int to reference (or reference to int): the phi has to change
78    //   to reference type. If the integer input cannot be converted to a
79    //   reference input, the phi will remain dead.
80    if (new_type == Primitive::kPrimVoid) {
81      new_type = input_type;
82    } else if (new_type == Primitive::kPrimNot && input_type == Primitive::kPrimInt) {
83      HInstruction* equivalent = SsaBuilder::GetReferenceTypeEquivalent(input);
84      if (equivalent == nullptr) {
85        conflict = true;
86        break;
87      } else {
88        phi->ReplaceInput(equivalent, i);
89        if (equivalent->IsPhi()) {
90          DCHECK_EQ(equivalent->GetType(), Primitive::kPrimNot);
91          // We created a new phi, but that phi has the same inputs as the old phi. We
92          // add it to the worklist to ensure its inputs can also be converted to reference.
93          // If not, it will remain dead, and the algorithm will make the current phi dead
94          // as well.
95          equivalent->AsPhi()->SetLive();
96          AddToWorklist(equivalent->AsPhi());
97        }
98      }
99    } else if (new_type == Primitive::kPrimInt && input_type == Primitive::kPrimNot) {
100      new_type = Primitive::kPrimNot;
101      // Start over, we may request reference equivalents for the inputs of the phi.
102      i = -1;
103    } else if (new_type != input_type) {
104      conflict = true;
105      break;
106    }
107  }
108
109  if (conflict) {
110    phi->SetType(Primitive::kPrimVoid);
111    phi->SetDead();
112    return true;
113  } else {
114    DCHECK(phi->IsLive());
115    phi->SetType(new_type);
116    return existing != new_type;
117  }
118}
119
120void DeadPhiHandling::VisitBasicBlock(HBasicBlock* block) {
121  for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
122    HPhi* phi = it.Current()->AsPhi();
123    if (phi->IsDead() && phi->HasEnvironmentUses()) {
124      phi->SetLive();
125      if (block->IsLoopHeader()) {
126        // Give a type to the loop phi, to guarantee convergence of the algorithm.
127        phi->SetType(phi->InputAt(0)->GetType());
128        AddToWorklist(phi);
129      } else {
130        // Because we are doing a reverse post order visit, all inputs of
131        // this phi have been visited and therefore had their (initial) type set.
132        UpdateType(phi);
133      }
134    }
135  }
136}
137
138void DeadPhiHandling::ProcessWorklist() {
139  while (!worklist_.IsEmpty()) {
140    HPhi* instruction = worklist_.Pop();
141    // Note that the same equivalent phi can be added multiple times in the work list, if
142    // used by multiple phis. The first call to `UpdateType` will know whether the phi is
143    // dead or live.
144    if (instruction->IsLive() && UpdateType(instruction)) {
145      AddDependentInstructionsToWorklist(instruction);
146    }
147  }
148}
149
150void DeadPhiHandling::AddToWorklist(HPhi* instruction) {
151  DCHECK(instruction->IsLive());
152  worklist_.Add(instruction);
153}
154
155void DeadPhiHandling::AddDependentInstructionsToWorklist(HPhi* instruction) {
156  for (HUseIterator<HInstruction*> it(instruction->GetUses()); !it.Done(); it.Advance()) {
157    HPhi* phi = it.Current()->GetUser()->AsPhi();
158    if (phi != nullptr && !phi->IsDead()) {
159      AddToWorklist(phi);
160    }
161  }
162}
163
164void DeadPhiHandling::Run() {
165  for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) {
166    VisitBasicBlock(it.Current());
167  }
168  ProcessWorklist();
169}
170
171static bool IsPhiEquivalentOf(HInstruction* instruction, HPhi* phi) {
172  return instruction != nullptr
173      && instruction->IsPhi()
174      && instruction->AsPhi()->GetRegNumber() == phi->GetRegNumber();
175}
176
177void SsaBuilder::FixNullConstantType() {
178  // The order doesn't matter here.
179  for (HReversePostOrderIterator itb(*GetGraph()); !itb.Done(); itb.Advance()) {
180    for (HInstructionIterator it(itb.Current()->GetInstructions()); !it.Done(); it.Advance()) {
181      HInstruction* equality_instr = it.Current();
182      if (!equality_instr->IsEqual() && !equality_instr->IsNotEqual()) {
183        continue;
184      }
185      HInstruction* left = equality_instr->InputAt(0);
186      HInstruction* right = equality_instr->InputAt(1);
187      HInstruction* int_operand = nullptr;
188
189      if ((left->GetType() == Primitive::kPrimNot) && (right->GetType() == Primitive::kPrimInt)) {
190        int_operand = right;
191      } else if ((right->GetType() == Primitive::kPrimNot)
192                 && (left->GetType() == Primitive::kPrimInt)) {
193        int_operand = left;
194      } else {
195        continue;
196      }
197
198      // If we got here, we are comparing against a reference and the int constant
199      // should be replaced with a null constant.
200      // Both type propagation and redundant phi elimination ensure `int_operand`
201      // can only be the 0 constant.
202      DCHECK(int_operand->IsIntConstant());
203      DCHECK_EQ(0, int_operand->AsIntConstant()->GetValue());
204      equality_instr->ReplaceInput(GetGraph()->GetNullConstant(), int_operand == right ? 1 : 0);
205    }
206  }
207}
208
209void SsaBuilder::EquivalentPhisCleanup() {
210  // The order doesn't matter here.
211  for (HReversePostOrderIterator itb(*GetGraph()); !itb.Done(); itb.Advance()) {
212    for (HInstructionIterator it(itb.Current()->GetPhis()); !it.Done(); it.Advance()) {
213      HPhi* phi = it.Current()->AsPhi();
214      HPhi* next = phi->GetNextEquivalentPhiWithSameType();
215      if (next != nullptr) {
216        phi->ReplaceWith(next);
217        DCHECK(next->GetNextEquivalentPhiWithSameType() == nullptr)
218            << "More then one phi equivalent with type " << phi->GetType()
219            << " found for phi" << phi->GetId();
220      }
221    }
222  }
223}
224
225void SsaBuilder::BuildSsa() {
226  // 1) Visit in reverse post order. We need to have all predecessors of a block visited
227  // (with the exception of loops) in order to create the right environment for that
228  // block. For loops, we create phis whose inputs will be set in 2).
229  for (HReversePostOrderIterator it(*GetGraph()); !it.Done(); it.Advance()) {
230    VisitBasicBlock(it.Current());
231  }
232
233  // 2) Set inputs of loop phis.
234  for (size_t i = 0; i < loop_headers_.Size(); i++) {
235    HBasicBlock* block = loop_headers_.Get(i);
236    for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
237      HPhi* phi = it.Current()->AsPhi();
238      for (size_t pred = 0; pred < block->GetPredecessors().Size(); pred++) {
239        HInstruction* input = ValueOfLocal(block->GetPredecessors().Get(pred), phi->GetRegNumber());
240        phi->AddInput(input);
241      }
242    }
243  }
244
245  // 3) Mark dead phis. This will mark phis that are only used by environments:
246  // at the DEX level, the type of these phis does not need to be consistent, but
247  // our code generator will complain if the inputs of a phi do not have the same
248  // type. The marking allows the type propagation to know which phis it needs
249  // to handle. We mark but do not eliminate: the elimination will be done in
250  // step 9).
251  SsaDeadPhiElimination dead_phis_for_type_propagation(GetGraph());
252  dead_phis_for_type_propagation.MarkDeadPhis();
253
254  // 4) Propagate types of phis. At this point, phis are typed void in the general
255  // case, or float/double/reference when we created an equivalent phi. So we
256  // need to propagate the types across phis to give them a correct type.
257  PrimitiveTypePropagation type_propagation(GetGraph());
258  type_propagation.Run();
259
260  // 5) When creating equivalent phis we copy the inputs of the original phi which
261  // may be improperly typed. This was fixed during the type propagation in 4) but
262  // as a result we may end up with two equivalent phis with the same type for
263  // the same dex register. This pass cleans them up.
264  EquivalentPhisCleanup();
265
266  // 6) Mark dead phis again. Step 4) may have introduced new phis.
267  // Step 5) might enable the death of new phis.
268  SsaDeadPhiElimination dead_phis(GetGraph());
269  dead_phis.MarkDeadPhis();
270
271  // 7) Now that the graph is correctly typed, we can get rid of redundant phis.
272  // Note that we cannot do this phase before type propagation, otherwise
273  // we could get rid of phi equivalents, whose presence is a requirement for the
274  // type propagation phase. Note that this is to satisfy statement (a) of the
275  // SsaBuilder (see ssa_builder.h).
276  SsaRedundantPhiElimination redundant_phi(GetGraph());
277  redundant_phi.Run();
278
279  // 8) Fix the type for null constants which are part of an equality comparison.
280  // We need to do this after redundant phi elimination, to ensure the only cases
281  // that we can see are reference comparison against 0. The redundant phi
282  // elimination ensures we do not see a phi taking two 0 constants in a HEqual
283  // or HNotEqual.
284  FixNullConstantType();
285
286  // 9) Make sure environments use the right phi "equivalent": a phi marked dead
287  // can have a phi equivalent that is not dead. We must therefore update
288  // all environment uses of the dead phi to use its equivalent. Note that there
289  // can be multiple phis for the same Dex register that are live (for example
290  // when merging constants), in which case it is OK for the environments
291  // to just reference one.
292  for (HReversePostOrderIterator it(*GetGraph()); !it.Done(); it.Advance()) {
293    HBasicBlock* block = it.Current();
294    for (HInstructionIterator it_phis(block->GetPhis()); !it_phis.Done(); it_phis.Advance()) {
295      HPhi* phi = it_phis.Current()->AsPhi();
296      // If the phi is not dead, or has no environment uses, there is nothing to do.
297      if (!phi->IsDead() || !phi->HasEnvironmentUses()) continue;
298      HInstruction* next = phi->GetNext();
299      if (!IsPhiEquivalentOf(next, phi)) continue;
300      if (next->AsPhi()->IsDead()) {
301        // If the phi equivalent is dead, check if there is another one.
302        next = next->GetNext();
303        if (!IsPhiEquivalentOf(next, phi)) continue;
304        // There can be at most two phi equivalents.
305        DCHECK(!IsPhiEquivalentOf(next->GetNext(), phi));
306        if (next->AsPhi()->IsDead()) continue;
307      }
308      // We found a live phi equivalent. Update the environment uses of `phi` with it.
309      phi->ReplaceWith(next);
310    }
311  }
312
313  // 10) Deal with phis to guarantee liveness of phis in case of a debuggable
314  // application. This is for satisfying statement (c) of the SsaBuilder
315  // (see ssa_builder.h).
316  if (GetGraph()->IsDebuggable()) {
317    DeadPhiHandling dead_phi_handler(GetGraph());
318    dead_phi_handler.Run();
319  }
320
321  // 11) Now that the right phis are used for the environments, and we
322  // have potentially revive dead phis in case of a debuggable application,
323  // we can eliminate phis we do not need. Regardless of the debuggable status,
324  // this phase is necessary for statement (b) of the SsaBuilder (see ssa_builder.h),
325  // as well as for the code generation, which does not deal with phis of conflicting
326  // input types.
327  dead_phis.EliminateDeadPhis();
328
329  // 12) Clear locals.
330  for (HInstructionIterator it(GetGraph()->GetEntryBlock()->GetInstructions());
331       !it.Done();
332       it.Advance()) {
333    HInstruction* current = it.Current();
334    if (current->IsLocal()) {
335      current->GetBlock()->RemoveInstruction(current);
336    }
337  }
338}
339
340HInstruction* SsaBuilder::ValueOfLocal(HBasicBlock* block, size_t local) {
341  return GetLocalsFor(block)->Get(local);
342}
343
344void SsaBuilder::VisitBasicBlock(HBasicBlock* block) {
345  current_locals_ = GetLocalsFor(block);
346
347  if (block->IsLoopHeader()) {
348    // If the block is a loop header, we know we only have visited the pre header
349    // because we are visiting in reverse post order. We create phis for all initialized
350    // locals from the pre header. Their inputs will be populated at the end of
351    // the analysis.
352    for (size_t local = 0; local < current_locals_->Size(); local++) {
353      HInstruction* incoming = ValueOfLocal(block->GetLoopInformation()->GetPreHeader(), local);
354      if (incoming != nullptr) {
355        HPhi* phi = new (GetGraph()->GetArena()) HPhi(
356            GetGraph()->GetArena(), local, 0, Primitive::kPrimVoid);
357        block->AddPhi(phi);
358        current_locals_->Put(local, phi);
359      }
360    }
361    // Save the loop header so that the last phase of the analysis knows which
362    // blocks need to be updated.
363    loop_headers_.Add(block);
364  } else if (block->GetPredecessors().Size() > 0) {
365    // All predecessors have already been visited because we are visiting in reverse post order.
366    // We merge the values of all locals, creating phis if those values differ.
367    for (size_t local = 0; local < current_locals_->Size(); local++) {
368      bool one_predecessor_has_no_value = false;
369      bool is_different = false;
370      HInstruction* value = ValueOfLocal(block->GetPredecessors().Get(0), local);
371
372      for (size_t i = 0, e = block->GetPredecessors().Size(); i < e; ++i) {
373        HInstruction* current = ValueOfLocal(block->GetPredecessors().Get(i), local);
374        if (current == nullptr) {
375          one_predecessor_has_no_value = true;
376          break;
377        } else if (current != value) {
378          is_different = true;
379        }
380      }
381
382      if (one_predecessor_has_no_value) {
383        // If one predecessor has no value for this local, we trust the verifier has
384        // successfully checked that there is a store dominating any read after this block.
385        continue;
386      }
387
388      if (is_different) {
389        HPhi* phi = new (GetGraph()->GetArena()) HPhi(
390            GetGraph()->GetArena(), local, block->GetPredecessors().Size(), Primitive::kPrimVoid);
391        for (size_t i = 0; i < block->GetPredecessors().Size(); i++) {
392          HInstruction* pred_value = ValueOfLocal(block->GetPredecessors().Get(i), local);
393          phi->SetRawInputAt(i, pred_value);
394        }
395        block->AddPhi(phi);
396        value = phi;
397      }
398      current_locals_->Put(local, value);
399    }
400  }
401
402  // Visit all instructions. The instructions of interest are:
403  // - HLoadLocal: replace them with the current value of the local.
404  // - HStoreLocal: update current value of the local and remove the instruction.
405  // - Instructions that require an environment: populate their environment
406  //   with the current values of the locals.
407  for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
408    it.Current()->Accept(this);
409  }
410}
411
412/**
413 * Constants in the Dex format are not typed. So the builder types them as
414 * integers, but when doing the SSA form, we might realize the constant
415 * is used for floating point operations. We create a floating-point equivalent
416 * constant to make the operations correctly typed.
417 */
418HFloatConstant* SsaBuilder::GetFloatEquivalent(HIntConstant* constant) {
419  // We place the floating point constant next to this constant.
420  HFloatConstant* result = constant->GetNext()->AsFloatConstant();
421  if (result == nullptr) {
422    HGraph* graph = constant->GetBlock()->GetGraph();
423    ArenaAllocator* allocator = graph->GetArena();
424    result = new (allocator) HFloatConstant(bit_cast<float, int32_t>(constant->GetValue()));
425    constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext());
426    graph->CacheFloatConstant(result);
427  } else {
428    // If there is already a constant with the expected type, we know it is
429    // the floating point equivalent of this constant.
430    DCHECK_EQ((bit_cast<int32_t, float>(result->GetValue())), constant->GetValue());
431  }
432  return result;
433}
434
435/**
436 * Wide constants in the Dex format are not typed. So the builder types them as
437 * longs, but when doing the SSA form, we might realize the constant
438 * is used for floating point operations. We create a floating-point equivalent
439 * constant to make the operations correctly typed.
440 */
441HDoubleConstant* SsaBuilder::GetDoubleEquivalent(HLongConstant* constant) {
442  // We place the floating point constant next to this constant.
443  HDoubleConstant* result = constant->GetNext()->AsDoubleConstant();
444  if (result == nullptr) {
445    HGraph* graph = constant->GetBlock()->GetGraph();
446    ArenaAllocator* allocator = graph->GetArena();
447    result = new (allocator) HDoubleConstant(bit_cast<double, int64_t>(constant->GetValue()));
448    constant->GetBlock()->InsertInstructionBefore(result, constant->GetNext());
449    graph->CacheDoubleConstant(result);
450  } else {
451    // If there is already a constant with the expected type, we know it is
452    // the floating point equivalent of this constant.
453    DCHECK_EQ((bit_cast<int64_t, double>(result->GetValue())), constant->GetValue());
454  }
455  return result;
456}
457
458/**
459 * Because of Dex format, we might end up having the same phi being
460 * used for non floating point operations and floating point / reference operations.
461 * Because we want the graph to be correctly typed (and thereafter avoid moves between
462 * floating point registers and core registers), we need to create a copy of the
463 * phi with a floating point / reference type.
464 */
465HPhi* SsaBuilder::GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type) {
466  // We place the floating point /reference phi next to this phi.
467  HInstruction* next = phi->GetNext();
468  if (next != nullptr
469      && next->AsPhi()->GetRegNumber() == phi->GetRegNumber()
470      && next->GetType() != type) {
471    // Move to the next phi to see if it is the one we are looking for.
472    next = next->GetNext();
473  }
474
475  if (next == nullptr
476      || (next->AsPhi()->GetRegNumber() != phi->GetRegNumber())
477      || (next->GetType() != type)) {
478    ArenaAllocator* allocator = phi->GetBlock()->GetGraph()->GetArena();
479    HPhi* new_phi = new (allocator) HPhi(allocator, phi->GetRegNumber(), phi->InputCount(), type);
480    for (size_t i = 0, e = phi->InputCount(); i < e; ++i) {
481      // Copy the inputs. Note that the graph may not be correctly typed by doing this copy,
482      // but the type propagation phase will fix it.
483      new_phi->SetRawInputAt(i, phi->InputAt(i));
484    }
485    phi->GetBlock()->InsertPhiAfter(new_phi, phi);
486    return new_phi;
487  } else {
488    DCHECK_EQ(next->GetType(), type);
489    return next->AsPhi();
490  }
491}
492
493HInstruction* SsaBuilder::GetFloatOrDoubleEquivalent(HInstruction* user,
494                                                     HInstruction* value,
495                                                     Primitive::Type type) {
496  if (value->IsArrayGet()) {
497    // The verifier has checked that values in arrays cannot be used for both
498    // floating point and non-floating point operations. It is therefore safe to just
499    // change the type of the operation.
500    value->AsArrayGet()->SetType(type);
501    return value;
502  } else if (value->IsLongConstant()) {
503    return GetDoubleEquivalent(value->AsLongConstant());
504  } else if (value->IsIntConstant()) {
505    return GetFloatEquivalent(value->AsIntConstant());
506  } else if (value->IsPhi()) {
507    return GetFloatDoubleOrReferenceEquivalentOfPhi(value->AsPhi(), type);
508  } else {
509    // For other instructions, we assume the verifier has checked that the dex format is correctly
510    // typed and the value in a dex register will not be used for both floating point and
511    // non-floating point operations. So the only reason an instruction would want a floating
512    // point equivalent is for an unused phi that will be removed by the dead phi elimination phase.
513    DCHECK(user->IsPhi()) << "is actually " << user->DebugName() << " (" << user->GetId() << ")";
514    return value;
515  }
516}
517
518HInstruction* SsaBuilder::GetReferenceTypeEquivalent(HInstruction* value) {
519  if (value->IsIntConstant() && value->AsIntConstant()->GetValue() == 0) {
520    return value->GetBlock()->GetGraph()->GetNullConstant();
521  } else if (value->IsPhi()) {
522    return GetFloatDoubleOrReferenceEquivalentOfPhi(value->AsPhi(), Primitive::kPrimNot);
523  } else {
524    return nullptr;
525  }
526}
527
528void SsaBuilder::VisitLoadLocal(HLoadLocal* load) {
529  HInstruction* value = current_locals_->Get(load->GetLocal()->GetRegNumber());
530  // If the operation requests a specific type, we make sure its input is of that type.
531  if (load->GetType() != value->GetType()) {
532    if (load->GetType() == Primitive::kPrimFloat || load->GetType() == Primitive::kPrimDouble) {
533      value = GetFloatOrDoubleEquivalent(load, value, load->GetType());
534    } else if (load->GetType() == Primitive::kPrimNot) {
535      value = GetReferenceTypeEquivalent(value);
536    }
537  }
538  load->ReplaceWith(value);
539  load->GetBlock()->RemoveInstruction(load);
540}
541
542void SsaBuilder::VisitStoreLocal(HStoreLocal* store) {
543  current_locals_->Put(store->GetLocal()->GetRegNumber(), store->InputAt(1));
544  store->GetBlock()->RemoveInstruction(store);
545}
546
547void SsaBuilder::VisitInstruction(HInstruction* instruction) {
548  if (!instruction->NeedsEnvironment()) {
549    return;
550  }
551  HEnvironment* environment = new (GetGraph()->GetArena()) HEnvironment(
552      GetGraph()->GetArena(),
553      current_locals_->Size(),
554      GetGraph()->GetDexFile(),
555      GetGraph()->GetMethodIdx(),
556      instruction->GetDexPc(),
557      GetGraph()->GetInvokeType(),
558      instruction);
559  environment->CopyFrom(*current_locals_);
560  instruction->SetRawEnvironment(environment);
561}
562
563void SsaBuilder::VisitTemporary(HTemporary* temp) {
564  // Temporaries are only used by the baseline register allocator.
565  temp->GetBlock()->RemoveInstruction(temp);
566}
567
568}  // namespace art
569