summaryrefslogtreecommitdiff
path: root/compiler/optimizing/loop_optimization.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-03-04 10:13:10 +0000
committer Vladimir Marko <vmarko@google.com> 2022-03-28 11:17:34 +0100
commit8d100bab7f9d93e7a83bfd2fe0829092d8f22aa0 (patch)
tree352a1b0d71ff76de4567960f7e19834b71a89b7e /compiler/optimizing/loop_optimization.cc
parentd5d11d9dae9b8cb7149c2aed6a9da977b87767b7 (diff)
Fix last value generation in loop optimization.
Instead of `in_body`, propagate the context block and loop information to make better decisions for trip count if the context is outside the loop. In particular, fix `InductionVarRange::IsConstant()` to take and use this information instead of assuming that we are asking about values in the loop body. For trip count with context outside the loop, we know that the value shall be the maximum trip count if the context is dominated by the loop control exit block. Test: Enable run-test 835-b216762268. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 216762268 Change-Id: Id564ba75c812d54abdd9b229e643cc8ab4701c52
Diffstat (limited to 'compiler/optimizing/loop_optimization.cc')
-rw-r--r--compiler/optimizing/loop_optimization.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index 9e298a5418..77dfe68bf6 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -1331,7 +1331,7 @@ bool HLoopOptimization::VectorizeDef(LoopNode* node,
}
if (TrySetVectorType(type, &restrictions) &&
node->loop_info->IsDefinedOutOfTheLoop(base) &&
- induction_range_.IsUnitStride(instruction, index, graph_, &offset) &&
+ induction_range_.IsUnitStride(instruction->GetBlock(), index, graph_, &offset) &&
VectorizeUse(node, value, generate_code, type, restrictions)) {
if (generate_code) {
GenerateVecSub(index, offset);
@@ -1412,7 +1412,7 @@ bool HLoopOptimization::VectorizeUse(LoopNode* node,
HInstruction* offset = nullptr;
if (HVecOperation::ToSignedType(type) == HVecOperation::ToSignedType(instruction->GetType()) &&
node->loop_info->IsDefinedOutOfTheLoop(base) &&
- induction_range_.IsUnitStride(instruction, index, graph_, &offset)) {
+ induction_range_.IsUnitStride(instruction->GetBlock(), index, graph_, &offset)) {
if (generate_code) {
GenerateVecSub(index, offset);
GenerateVecMem(instruction, vector_map_->Get(index), nullptr, offset, type);