mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
Fix formatting of recent alias-analysis commit
llvm-svn: 243215
This commit is contained in:
@@ -715,7 +715,7 @@ public:
|
||||
|
||||
/// @brief Pair of minimal/maximal access vectors representing
|
||||
/// read write and read only accesses
|
||||
using MinMaxVectorPairTy = std::pair<MinMaxVectorTy *,MinMaxVectorTy *>;
|
||||
using MinMaxVectorPairTy = std::pair<MinMaxVectorTy *, MinMaxVectorTy *>;
|
||||
|
||||
/// @brief Vector of pair of minimal/maximal access vectors representing
|
||||
/// non read only and read only accesses for each alias group.
|
||||
|
||||
@@ -1467,9 +1467,9 @@ static __isl_give isl_set *getAccessDomain(MemoryAccess *MA) {
|
||||
|
||||
/// @brief Wrapper function to calculate minimal/maximal accesses to each array.
|
||||
static bool calculateMinMaxAccess(__isl_take isl_union_map *Accesses,
|
||||
__isl_take isl_union_set *Domains,
|
||||
__isl_take isl_set *AssumedContext,
|
||||
Scop::MinMaxVectorTy *MinMaxAccesses){
|
||||
__isl_take isl_union_set *Domains,
|
||||
__isl_take isl_set *AssumedContext,
|
||||
Scop::MinMaxVectorTy *MinMaxAccesses) {
|
||||
|
||||
Accesses = isl_union_map_intersect_domain(Accesses, Domains);
|
||||
isl_union_set *Locations = isl_union_map_range(Accesses);
|
||||
@@ -1582,7 +1582,7 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
|
||||
|
||||
// If we don't have read only pointers check if there are at least two
|
||||
// non read only pointers, otherwise clear the alias group.
|
||||
if (ReadOnlyPairs.empty() && NonReadOnlyBaseValues.size() <= 1){
|
||||
if (ReadOnlyPairs.empty() && NonReadOnlyBaseValues.size() <= 1) {
|
||||
AG.clear();
|
||||
continue;
|
||||
}
|
||||
@@ -1603,15 +1603,14 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
|
||||
for (MemoryAccess *MA : AG)
|
||||
Accesses = isl_union_map_add_map(Accesses, MA->getAccessRelation());
|
||||
|
||||
bool Valid = calculateMinMaxAccess(Accesses, getDomains(),
|
||||
getAssumedContext(),
|
||||
MinMaxAccessesNonReadOnly);
|
||||
bool Valid = calculateMinMaxAccess(
|
||||
Accesses, getDomains(), getAssumedContext(), MinMaxAccessesNonReadOnly);
|
||||
|
||||
// Bail out if the number of values we need to compare is too large.
|
||||
// This is important as the number of comparisions grows quadratically with
|
||||
// the number of values we need to compare.
|
||||
if (!Valid || (MinMaxAccessesNonReadOnly->size() + !ReadOnlyPairs.empty() >
|
||||
RunTimeChecksMaxArraysPerGroup)){
|
||||
RunTimeChecksMaxArraysPerGroup)) {
|
||||
for (MinMaxAccessTy &MMA : *(MinMaxAccessesNonReadOnly)) {
|
||||
isl_pw_multi_aff_free(MMA.first);
|
||||
isl_pw_multi_aff_free(MMA.second);
|
||||
@@ -1629,9 +1628,9 @@ bool Scop::buildAliasGroups(AliasAnalysis &AA) {
|
||||
for (MemoryAccess *MA : ReadOnlyPair.second)
|
||||
Accesses = isl_union_map_add_map(Accesses, MA->getAccessRelation());
|
||||
|
||||
Valid = calculateMinMaxAccess(Accesses, getDomains(),getAssumedContext(),
|
||||
Valid = calculateMinMaxAccess(Accesses, getDomains(), getAssumedContext(),
|
||||
MinMaxAccessesReadOnly);
|
||||
MinMaxVectorPairTy pair(MinMaxAccessesNonReadOnly,MinMaxAccessesReadOnly);
|
||||
MinMaxVectorPairTy pair(MinMaxAccessesNonReadOnly, MinMaxAccessesReadOnly);
|
||||
MinMaxAliasGroups.push_back(pair);
|
||||
|
||||
if (!Valid)
|
||||
@@ -1788,39 +1787,38 @@ void Scop::printContext(raw_ostream &OS) const {
|
||||
}
|
||||
|
||||
void Scop::printAliasAssumptions(raw_ostream &OS) const {
|
||||
int noOfGroups=0;
|
||||
for (const MinMaxVectorPairTy &Pair : MinMaxAliasGroups){
|
||||
int noOfGroups = 0;
|
||||
for (const MinMaxVectorPairTy &Pair : MinMaxAliasGroups) {
|
||||
if (Pair.second->size() == 0)
|
||||
noOfGroups += 1;
|
||||
else
|
||||
noOfGroups += Pair.second->size();
|
||||
}
|
||||
|
||||
OS.indent(4) << "Alias Groups (" << noOfGroups << "):\n";
|
||||
OS.indent(4) << "Alias Groups (" << noOfGroups << "):\n";
|
||||
if (MinMaxAliasGroups.empty()) {
|
||||
OS.indent(8) << "n/a\n";
|
||||
return;
|
||||
}
|
||||
|
||||
for (const MinMaxVectorPairTy &Pair : MinMaxAliasGroups){
|
||||
for (const MinMaxVectorPairTy &Pair : MinMaxAliasGroups) {
|
||||
|
||||
// If the group has no read only accesses print the write accesses.
|
||||
if (Pair.second->empty()){
|
||||
if (Pair.second->empty()) {
|
||||
OS.indent(8) << "[[";
|
||||
for (MinMaxAccessTy &MMANonReadOnly : *(Pair.first)){
|
||||
OS << " <" << MMANonReadOnly.first << ", "
|
||||
<< MMANonReadOnly.second << ">";
|
||||
for (MinMaxAccessTy &MMANonReadOnly : *(Pair.first)) {
|
||||
OS << " <" << MMANonReadOnly.first << ", " << MMANonReadOnly.second
|
||||
<< ">";
|
||||
}
|
||||
OS << " ]]\n";
|
||||
}
|
||||
|
||||
for (MinMaxAccessTy &MMAReadOnly : *(Pair.second)){
|
||||
for (MinMaxAccessTy &MMAReadOnly : *(Pair.second)) {
|
||||
OS.indent(8) << "[[";
|
||||
OS << " <" << MMAReadOnly.first << ", "
|
||||
<< MMAReadOnly.second << ">";
|
||||
for (MinMaxAccessTy &MMANonReadOnly : *(Pair.first)){
|
||||
OS << " <" << MMANonReadOnly.first << ", "
|
||||
<< MMANonReadOnly.second << ">";
|
||||
OS << " <" << MMAReadOnly.first << ", " << MMAReadOnly.second << ">";
|
||||
for (MinMaxAccessTy &MMANonReadOnly : *(Pair.first)) {
|
||||
OS << " <" << MMANonReadOnly.first << ", " << MMANonReadOnly.second
|
||||
<< ">";
|
||||
}
|
||||
OS << " ]]\n";
|
||||
}
|
||||
|
||||
@@ -305,26 +305,22 @@ static __isl_give isl_ast_node *AtEachDomain(__isl_take isl_ast_node *Node,
|
||||
|
||||
// Build alias check condition given a pair of minimal/maximal access.
|
||||
static __isl_give isl_ast_expr *buildCondition(__isl_keep isl_ast_build *Build,
|
||||
Scop::MinMaxAccessTy *It0,
|
||||
Scop::MinMaxAccessTy *It1){
|
||||
isl_ast_expr *NonAliasGroup,*MinExpr, *MaxExpr;
|
||||
MinExpr =
|
||||
isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It0->first)));
|
||||
MaxExpr =
|
||||
isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It1->second)));
|
||||
NonAliasGroup = isl_ast_expr_le(MaxExpr, MinExpr);
|
||||
MinExpr =
|
||||
isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It1->first)));
|
||||
MaxExpr =
|
||||
isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It0->second)));
|
||||
NonAliasGroup =
|
||||
isl_ast_expr_or(NonAliasGroup, isl_ast_expr_le(MaxExpr, MinExpr));
|
||||
Scop::MinMaxAccessTy *It0,
|
||||
Scop::MinMaxAccessTy *It1) {
|
||||
isl_ast_expr *NonAliasGroup, *MinExpr, *MaxExpr;
|
||||
MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It0->first)));
|
||||
MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It1->second)));
|
||||
NonAliasGroup = isl_ast_expr_le(MaxExpr, MinExpr);
|
||||
MinExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It1->first)));
|
||||
MaxExpr = isl_ast_expr_address_of(isl_ast_build_access_from_pw_multi_aff(
|
||||
Build, isl_pw_multi_aff_copy(It0->second)));
|
||||
NonAliasGroup =
|
||||
isl_ast_expr_or(NonAliasGroup, isl_ast_expr_le(MaxExpr, MinExpr));
|
||||
|
||||
return NonAliasGroup;
|
||||
return NonAliasGroup;
|
||||
}
|
||||
|
||||
void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
|
||||
@@ -345,11 +341,11 @@ void IslAst::buildRunCondition(__isl_keep isl_ast_build *Build) {
|
||||
for (auto RWAccIt0 = MinMaxReadWrite->begin(); RWAccIt0 != RWAccEnd;
|
||||
++RWAccIt0) {
|
||||
for (auto RWAccIt1 = RWAccIt0 + 1; RWAccIt1 != RWAccEnd; ++RWAccIt1)
|
||||
RunCondition = isl_ast_expr_and(RunCondition,
|
||||
buildCondition(Build,RWAccIt0,RWAccIt1));
|
||||
RunCondition = isl_ast_expr_and(
|
||||
RunCondition, buildCondition(Build, RWAccIt0, RWAccIt1));
|
||||
for (Scop::MinMaxAccessTy &ROAccIt : *MinMaxReadOnly)
|
||||
RunCondition = isl_ast_expr_and(RunCondition,
|
||||
buildCondition(Build,RWAccIt0,&ROAccIt));
|
||||
RunCondition = isl_ast_expr_and(
|
||||
RunCondition, buildCondition(Build, RWAccIt0, &ROAccIt));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user