From 8d100bab7f9d93e7a83bfd2fe0829092d8f22aa0 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 4 Mar 2022 10:13:10 +0000 Subject: 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 --- compiler/optimizing/nodes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 42f03a0bc7..7a0059f616 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1417,7 +1417,7 @@ class HBasicBlock : public ArenaObject { bool HasThrowingInstructions() const; // Returns whether this block dominates the blocked passed as parameter. - bool Dominates(HBasicBlock* block) const; + bool Dominates(const HBasicBlock* block) const; size_t GetLifetimeStart() const { return lifetime_start_; } size_t GetLifetimeEnd() const { return lifetime_end_; } -- cgit v1.2.3-59-g8ed1b