summaryrefslogtreecommitdiff
path: root/compiler/optimizing/loop_optimization.cc
diff options
context:
space:
mode:
authorAart Bik <ajcbik@google.com>2017-04-06 09:59:06 -0700
committerAart Bik <ajcbik@google.com>2017-04-06 10:11:40 -0700
commit24b905f4c4b3fd6eff6ba55e33ed4f81073e5327 (patch)
tree93e03e0c84976f84072fbc2f78a284183515af58 /compiler/optimizing/loop_optimization.cc
parent6bca1c6389bb002d44f1c0cabf7641de8c935c4b (diff)
Fix a few comments in vectorization code that were incorrect or incomplete.
Test: test-art-target Change-Id: I7c6a5a2d29edd0b2782abc303d8d8cb09c1c2f91
Diffstat (limited to 'compiler/optimizing/loop_optimization.cc')
-rw-r--r--compiler/optimizing/loop_optimization.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index ca31bf89e6..1a79601a93 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -544,12 +544,13 @@ void HLoopOptimization::GenerateNewLoop(LoopNode* node,
bool vectorized_def = VectorizeDef(node, it.Current(), /*generate_code*/ true);
DCHECK(vectorized_def);
}
- // Generate body.
+ // Generate body from the instruction map, but in original program order.
HEnvironment* env = vector_header_->GetFirstInstruction()->GetEnvironment();
for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) {
auto i = vector_map_->find(it.Current());
if (i != vector_map_->end() && !i->second->IsInBlock()) {
- Insert(vector_body_, i->second); // lays out in original order
+ Insert(vector_body_, i->second);
+ // Deal with instructions that need an environment, such as the scalar intrinsics.
if (i->second->NeedsEnvironment()) {
i->second->CopyEnvironmentFromWithLoopPhiAdjustment(env, vector_header_);
}
@@ -991,8 +992,9 @@ void HLoopOptimization::GenerateVecOp(HInstruction* org,
UNREACHABLE();
} // switch invoke
} else {
- // In scalar code, simply clone the method invoke, and replace its operands
- // with the corresponding new scalar instructions in the loop.
+ // In scalar code, simply clone the method invoke, and replace its operands with the
+ // corresponding new scalar instructions in the loop. The instruction will get an
+ // environment while being inserted from the instruction map in original program order.
DCHECK(vector_mode_ == kSequential);
HInvokeStaticOrDirect* new_invoke = new (global_allocator_) HInvokeStaticOrDirect(
global_allocator_,