From 7f56ff42ac663ccfa62034ed22297bd7d9bce2f6 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Wed, 30 Aug 2017 10:20:47 -0700 Subject: Refined range rule for ABS(x) Rationale; ABS(minint) = minint prevents assuming >=0 always. With a fail-before(sig11)/pass-after regression test. Test: 623 Change-Id: If5fb1580b207c7cdd964f7498849d1768bb1589d --- compiler/optimizing/induction_var_range.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/induction_var_range.cc') diff --git a/compiler/optimizing/induction_var_range.cc b/compiler/optimizing/induction_var_range.cc index f35aace3a9..089340e715 100644 --- a/compiler/optimizing/induction_var_range.cc +++ b/compiler/optimizing/induction_var_range.cc @@ -87,8 +87,10 @@ static bool IsGEZero(HInstruction* instruction) { IsGEZero(instruction->InputAt(1)); case Intrinsics::kMathAbsInt: case Intrinsics::kMathAbsLong: - // Instruction ABS(x) is >= 0. - return true; + // Instruction ABS(>=0) is >= 0. + // NOTE: ABS(minint) = minint prevents assuming + // >= 0 without looking at the argument. + return IsGEZero(instruction->InputAt(0)); default: break; } -- cgit v1.2.3-59-g8ed1b