From 854a02b1b488327f80c544ca1119b386b8715c26 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Tue, 14 Jul 2015 16:07:00 -0700 Subject: Improved side effect analysis (field/array write/read). Rationale: Types (int, float etc.) and access type (field vs. array) can be used to disambiguate write/read side-effects analysis. This directly improves e.g. dead code elimination and licm. Change-Id: I371f6909a3f42bda13190a03f04c4a867bde1d06 --- compiler/optimizing/side_effects_analysis.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/side_effects_analysis.cc') diff --git a/compiler/optimizing/side_effects_analysis.cc b/compiler/optimizing/side_effects_analysis.cc index ea1ca5a731..9dbf638442 100644 --- a/compiler/optimizing/side_effects_analysis.cc +++ b/compiler/optimizing/side_effects_analysis.cc @@ -24,14 +24,15 @@ void SideEffectsAnalysis::Run() { block_effects_.SetSize(graph_->GetBlocks().Size()); loop_effects_.SetSize(graph_->GetBlocks().Size()); + // In DEBUG mode, ensure side effects are properly initialized to empty. if (kIsDebugBuild) { for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); SideEffects effects = GetBlockEffects(block); - DCHECK(!effects.HasSideEffects() && !effects.HasDependencies()); + DCHECK(effects.DoesNothing()); if (block->IsLoopHeader()) { effects = GetLoopEffects(block); - DCHECK(!effects.HasSideEffects() && !effects.HasDependencies()); + DCHECK(effects.DoesNothing()); } } } @@ -46,7 +47,9 @@ void SideEffectsAnalysis::Run() { inst_it.Advance()) { HInstruction* instruction = inst_it.Current(); effects = effects.Union(instruction->GetSideEffects()); - if (effects.HasAllSideEffects()) { + // If every possible write/read is represented, scanning further + // will not add any more information to side-effects of this block. + if (effects.DoesAll()) { break; } } -- cgit v1.2.3-59-g8ed1b