Fix a few comments in vectorization code that were incorrect or incomplete.
Test: test-art-target
Change-Id: I7c6a5a2d29edd0b2782abc303d8d8cb09c1c2f91
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index ca31bf8..1a79601 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -544,12 +544,13 @@
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 @@
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_,