From 7023bf8227b3f46f4c3cc98e18889f54a584cd16 Mon Sep 17 00:00:00 2001 From: Santiago Aboy Solanes Date: Fri, 19 Aug 2022 10:28:11 +0100 Subject: Remove instructions from dead blocks when building the dominator tree We now remove the instructions to free up memory. We have to refactor methods a little bit to avoid removing instructions as users twice, since we do not support that. Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b Change-Id: Ia34c4a6af204952d295e5a2cb534115ced97ab07 --- compiler/optimizing/nodes.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 103d318710..98bcd38609 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1351,11 +1351,14 @@ class HBasicBlock : public ArenaObject { // skip updating those phis. void DisconnectFromSuccessors(const ArenaBitVector* visited = nullptr); - // Removes the catch phi uses of the instructions in `this`. If `remove_instruction` is set to - // true, it will also remove the instructions themselves. This method assumes the instructions - // have been removed from all users with the exception of catch phis because of missing - // exceptional edges in the graph. - void RemoveCatchPhiUses(bool remove_instruction); + // Removes the catch phi uses of the instructions in `this`, and then remove the instruction + // itself. If `building_dominator_tree` is true, it will not remove the instruction as user, since + // we do it in a previous step. This is a special case for building up the dominator tree: we want + // to eliminate uses before inputs but we don't have domination information, so we remove all + // connections from input/uses first before removing any instruction. + // This method assumes the instructions have been removed from all users with the exception of + // catch phis because of missing exceptional edges in the graph. + void RemoveCatchPhiUsesAndInstruction(bool building_dominator_tree); void AddInstruction(HInstruction* instruction); // Insert `instruction` before/after an existing instruction `cursor`. -- cgit v1.2.3-59-g8ed1b