// A cap for the number of heap locations to prevent pathological time/space consumption. // The number of heap locations for most of the methods stays below this threshold.
constexpr size_t kMaxNumberOfHeapLocations = 32;
// Test if two integer ranges [l1,h1] and [l2,h2] overlap. // Note that the ranges are inclusive on both ends. // l1|------|h1 // l2|------|h2 staticbool CanIntegerRangesOverlap(int64_t l1, int64_t h1, int64_t l2, int64_t h2) { return std::max(l1, l2) <= std::min(h1, h2);
}
staticbool CanBinaryOpAndIndexAlias(const HBinaryOperation* idx1, const size_t vector_length1, const HInstruction* idx2, const size_t vector_length2) { if (!IsAddOrSub(idx1)) { // We currently only support Add and Sub operations. returntrue;
} if (idx1->GetLeastConstantLeft() != idx2) { // Cannot analyze [i+CONST1] and [j]. returntrue;
} if (!idx1->GetConstantRight()->IsIntConstant()) { returntrue;
}
// Since 'i' are the same in [i+CONST] and [i], // further compare [CONST] and [0].
int64_t l1 = idx1->IsAdd()
? idx1->GetConstantRight()->AsIntConstant()->GetValue()
: -idx1->GetConstantRight()->AsIntConstant()->GetValue();
int64_t l2 = 0;
int64_t h1 = l1 + (vector_length1 - 1);
int64_t h2 = l2 + (vector_length2 - 1); return CanIntegerRangesOverlap(l1, h1, l2, h2);
}
staticbool CanBinaryOpsAlias(const HBinaryOperation* idx1, const size_t vector_length1, const HBinaryOperation* idx2, const size_t vector_length2) { if (!IsAddOrSub(idx1) || !IsAddOrSub(idx2)) { // We currently only support Add and Sub operations. returntrue;
} if (idx1->GetLeastConstantLeft() != idx2->GetLeastConstantLeft()) { // Cannot analyze [i+CONST1] and [j+CONST2]. returntrue;
} if (!idx1->GetConstantRight()->IsIntConstant() ||
!idx2->GetConstantRight()->IsIntConstant()) { returntrue;
}
// Since 'i' are the same in [i+CONST1] and [i+CONST2], // further compare [CONST1] and [CONST2].
int64_t l1 = idx1->IsAdd()
? idx1->GetConstantRight()->AsIntConstant()->GetValue()
: -idx1->GetConstantRight()->AsIntConstant()->GetValue();
int64_t l2 = idx2->IsAdd()
? idx2->GetConstantRight()->AsIntConstant()->GetValue()
: -idx2->GetConstantRight()->AsIntConstant()->GetValue();
int64_t h1 = l1 + (vector_length1 - 1);
int64_t h2 = l2 + (vector_length2 - 1); return CanIntegerRangesOverlap(l1, h1, l2, h2);
}
bool LoadStoreAnalysis::Run() { // Currently load_store analysis can't handle predicated load/stores; specifically pairs of // memory operations with different predicates. // TODO: support predicated SIMD. if (graph_->HasPredicatedSIMD()) { returnfalse;
}
heap_location_collector_.VisitReversePostOrder();
if (heap_location_collector_.GetNumberOfHeapLocations() > kMaxNumberOfHeapLocations) { // Bail out if there are too many heap locations to deal with.
heap_location_collector_.CleanUp(); returnfalse;
} if (!heap_location_collector_.HasHeapStores()) { // Without heap stores, this pass would act mostly as GVN on heap accesses.
heap_location_collector_.CleanUp(); returnfalse;
}
heap_location_collector_.BuildAliasingMatrix();
heap_location_collector_.DumpReferenceStats(stats_); returntrue;
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.