From c3d743fa2a26effcb35627d8a1338029c86e582a Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Wed, 22 Apr 2015 13:40:50 +0100 Subject: ART: Update last_instruction when adding Phis HBasicBlock::InsertPhiAfter would not update the last_instruction pointer when adding at the end of the list. This could cause problems when iterating over phis backwards. Fortunately, we don't do that anywhere in the existing code. Change-Id: I4487265bf2cf3d3819623fafd7ce7c359bac190e --- compiler/optimizing/nodes.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 08fcdbbcdc..1a24cb516b 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -75,6 +75,10 @@ class HInstructionList { void AddInstruction(HInstruction* instruction); void RemoveInstruction(HInstruction* instruction); + // Insert `instruction` before/after an existing instruction `cursor`. + void InsertInstructionBefore(HInstruction* instruction, HInstruction* cursor); + void InsertInstructionAfter(HInstruction* instruction, HInstruction* cursor); + // Return true if this list contains `instruction`. bool Contains(HInstruction* instruction) const; @@ -467,8 +471,9 @@ class HBasicBlock : public ArenaObject { HInstruction* GetFirstInstruction() const { return instructions_.first_instruction_; } HInstruction* GetLastInstruction() const { return instructions_.last_instruction_; } const HInstructionList& GetInstructions() const { return instructions_; } - const HInstructionList& GetPhis() const { return phis_; } HInstruction* GetFirstPhi() const { return phis_.first_instruction_; } + HInstruction* GetLastPhi() const { return phis_.last_instruction_; } + const HInstructionList& GetPhis() const { return phis_; } void AddSuccessor(HBasicBlock* block) { successors_.Add(block); -- cgit v1.2.3-59-g8ed1b