summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorMingyao Yang <mingyao@google.com>2015-03-03 00:02:26 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-03 00:02:28 +0000
commit4b39eeea67b0fecf21588d7b00e92eb844014c24 (patch)
tree10bb8bc99f7c7241efe3b3c6dd004d612aba4acc /compiler/optimizing
parent87998b0a959a50dff43ce469678e84bd083279f3 (diff)
parent4559f000b323b64e4bd179b72cfb788b30b25b23 (diff)
downloadart-4b39eeea67b0fecf21588d7b00e92eb844014c24.zip
art-4b39eeea67b0fecf21588d7b00e92eb844014c24.tar.gz
art-4b39eeea67b0fecf21588d7b00e92eb844014c24.tar.bz2
Merge "bce: handle a pattern for circular buffer"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/bounds_check_elimination.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/optimizing/bounds_check_elimination.cc b/compiler/optimizing/bounds_check_elimination.cc
index 811a3bd..deaeb8e 100644
--- a/compiler/optimizing/bounds_check_elimination.cc
+++ b/compiler/optimizing/bounds_check_elimination.cc
@@ -823,6 +823,21 @@ class BCEVisitor : public HGraphVisitor {
FindAndHandlePartialArrayLength(ushr);
}
+ void VisitAnd(HAnd* instruction) {
+ if (instruction->GetRight()->IsIntConstant()) {
+ int32_t constant = instruction->GetRight()->AsIntConstant()->GetValue();
+ if (constant > 0) {
+ // constant serves as a mask so any number masked with it
+ // gets a [0, constant] value range.
+ ValueRange* range = new (GetGraph()->GetArena()) ValueRange(
+ GetGraph()->GetArena(),
+ ValueBound(nullptr, 0),
+ ValueBound(nullptr, constant));
+ GetValueRangeMap(instruction->GetBlock())->Overwrite(instruction->GetId(), range);
+ }
+ }
+ }
+
void VisitNewArray(HNewArray* new_array) {
HInstruction* len = new_array->InputAt(0);
if (!len->IsIntConstant()) {