diff options
| author | 2025-02-20 05:35:59 -0800 | |
|---|---|---|
| committer | 2025-02-20 05:35:59 -0800 | |
| commit | b25bfc7b15c0188a12e69b0dc2beca18a2a63c89 (patch) | |
| tree | 8f26c86398e7cd4c1600d224ddbb31e38588c8fe /compiler/optimizing/code_sinking.cc | |
| parent | 8b37b651cde6eb2567efa05fff0118ba295c31dd (diff) | |
| parent | 111a92c97af940b5539f14a114fa6947ea6ac95f (diff) | |
Introduce `BitVectorView<>`. am: 16a42183af am: 111a92c97a
Original change: https://android-review.googlesource.com/c/platform/art/+/3500455
Change-Id: Icec58591fe6c52a4dcca58d4d37fc36018fa38fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'compiler/optimizing/code_sinking.cc')
| -rw-r--r-- | compiler/optimizing/code_sinking.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/compiler/optimizing/code_sinking.cc b/compiler/optimizing/code_sinking.cc index 0abcaea719..b1d14132c4 100644 --- a/compiler/optimizing/code_sinking.cc +++ b/compiler/optimizing/code_sinking.cc @@ -150,8 +150,8 @@ static bool IsInterestingInstruction(HInstruction* instruction) { } static void AddInstruction(HInstruction* instruction, - const ArenaBitVector& processed_instructions, - const ArenaBitVector& discard_blocks, + BitVectorView<size_t> processed_instructions, + BitVectorView<size_t> discard_blocks, ScopedArenaVector<HInstruction*>* worklist) { // Add to the work list if the instruction is not in the list of blocks // to discard, hasn't been already processed and is of interest. @@ -163,8 +163,8 @@ static void AddInstruction(HInstruction* instruction, } static void AddInputs(HInstruction* instruction, - const ArenaBitVector& processed_instructions, - const ArenaBitVector& discard_blocks, + BitVectorView<size_t> processed_instructions, + BitVectorView<size_t> discard_blocks, ScopedArenaVector<HInstruction*>* worklist) { for (HInstruction* input : instruction->GetInputs()) { AddInstruction(input, processed_instructions, discard_blocks, worklist); @@ -172,8 +172,8 @@ static void AddInputs(HInstruction* instruction, } static void AddInputs(HBasicBlock* block, - const ArenaBitVector& processed_instructions, - const ArenaBitVector& discard_blocks, + BitVectorView<size_t> processed_instructions, + BitVectorView<size_t> discard_blocks, ScopedArenaVector<HInstruction*>* worklist) { for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { AddInputs(it.Current(), processed_instructions, discard_blocks, worklist); @@ -185,7 +185,7 @@ static void AddInputs(HBasicBlock* block, static bool ShouldFilterUse(HInstruction* instruction, HInstruction* user, - const ArenaBitVector& post_dominated) { + BitVectorView<size_t> post_dominated) { if (instruction->IsNewInstance()) { return (user->IsInstanceFieldSet() || user->IsConstructorFence()) && (user->InputAt(0) == instruction) && @@ -204,7 +204,7 @@ static bool ShouldFilterUse(HInstruction* instruction, // This method is tailored to the sinking algorithm, unlike // the generic HInstruction::MoveBeforeFirstUserAndOutOfLoops. static HInstruction* FindIdealPosition(HInstruction* instruction, - const ArenaBitVector& post_dominated, + BitVectorView<size_t> post_dominated, bool filter = false) { DCHECK(!instruction->IsPhi()); // Makes no sense for Phi. @@ -333,9 +333,10 @@ void CodeSinking::SinkCodeToUncommonBranch(HBasicBlock* end_block) { size_t number_of_instructions = graph_->GetCurrentInstructionId(); ScopedArenaVector<HInstruction*> worklist(allocator.Adapter(kArenaAllocMisc)); - ArenaBitVector processed_instructions( - &allocator, number_of_instructions, /* expandable= */ false); - ArenaBitVector post_dominated(&allocator, graph_->GetBlocks().size(), /* expandable= */ false); + BitVectorView<size_t> processed_instructions = + ArenaBitVector::CreateFixedSize(&allocator, number_of_instructions); + BitVectorView<size_t> post_dominated = + ArenaBitVector::CreateFixedSize(&allocator, graph_->GetBlocks().size()); // Step (1): Visit post order to get a subset of blocks post dominated by `end_block`. // TODO(ngeoffray): Getting the full set of post-dominated should be done by |