diff options
author | 2020-06-26 13:28:33 +0100 | |
---|---|---|
committer | 2020-07-02 10:49:08 +0000 | |
commit | af92a0f06fe3ab2618ccc220df3dacc3a20d8bb1 (patch) | |
tree | a1825765fba713b9805a26b35743506907cdefe8 /compiler/optimizing/induction_var_range.cc | |
parent | 8d799686ff11ef800a8489272f4e0b36b6ab21b3 (diff) |
ARM: Optimize Div/Rem by 2^n for non-negative dividends
When it can be proved that dividends are non-negative or the min integer
if their type is integral, there is no need to generate instructions
correcting the result.
The CL implements this optimization for ARM32/ARM64.
Test: 411-checker-hdiv-hrem-pow2
Test: test.py --host --optimizing --jit --gtest --interpreter
Test: test.py -target --optimizing --jit --interpreter
Test: run-gtests.sh
Change-Id: I11211a42918b5801fce8e78f305e69549739c23c
Diffstat (limited to 'compiler/optimizing/induction_var_range.cc')
-rw-r--r-- | compiler/optimizing/induction_var_range.cc | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/compiler/optimizing/induction_var_range.cc b/compiler/optimizing/induction_var_range.cc index 4c78fa8f06..72c2064d89 100644 --- a/compiler/optimizing/induction_var_range.cc +++ b/compiler/optimizing/induction_var_range.cc @@ -70,28 +70,6 @@ static int64_t IntPow(int64_t b, int64_t e, /*out*/ bool* overflow) { return pow; } -/** - * Detects an instruction that is >= 0. As long as the value is carried by - * a single instruction, arithmetic wrap-around cannot occur. - */ -static bool IsGEZero(HInstruction* instruction) { - DCHECK(instruction != nullptr); - if (instruction->IsArrayLength()) { - return true; - } else if (instruction->IsMin()) { - // Instruction MIN(>=0, >=0) is >= 0. - return IsGEZero(instruction->InputAt(0)) && - IsGEZero(instruction->InputAt(1)); - } else if (instruction->IsAbs()) { - // Instruction ABS(>=0) is >= 0. - // NOTE: ABS(minint) = minint prevents assuming - // >= 0 without looking at the argument. - return IsGEZero(instruction->InputAt(0)); - } - int64_t value = -1; - return IsInt64AndGet(instruction, &value) && value >= 0; -} - /** Hunts "under the hood" for a suitable instruction at the hint. */ static bool IsMaxAtHint( HInstruction* instruction, HInstruction* hint, /*out*/HInstruction** suitable) { |