24#include "llvm/ADT/Statistic.h"
25#include "llvm/IR/Module.h"
28#define DEBUG_TYPE "polly-delicm"
35static cl::opt<bool> PollyPrintDeLICM(
"polly-print-delicm",
36 cl::desc(
"Polly - Print DeLICM/DePRE"),
40 DelicmMaxOps(
"polly-delicm-max-ops",
41 cl::desc(
"Maximum number of isl operations to invest for "
42 "lifetime analysis; 0=no limit"),
45cl::opt<bool> DelicmOverapproximateWrites(
46 "polly-delicm-overapproximate-writes",
48 "Do more PHI writes than necessary in order to avoid partial accesses"),
51cl::opt<bool> DelicmPartialWrites(
"polly-delicm-partial-writes",
52 cl::desc(
"Allow partial writes"),
53 cl::init(
true), cl::Hidden,
57 DelicmComputeKnown(
"polly-delicm-compute-known",
58 cl::desc(
"Compute known content of array elements"),
61STATISTIC(DeLICMAnalyzed,
"Number of successfully analyzed SCoPs");
63 "Analyses aborted because max_operations was reached");
64STATISTIC(MappedValueScalars,
"Number of mapped Value scalars");
65STATISTIC(MappedPHIScalars,
"Number of mapped PHI scalars");
66STATISTIC(TargetsMapped,
"Number of stores used for at least one mapping");
67STATISTIC(DeLICMScopsModified,
"Number of SCoPs optimized");
69STATISTIC(NumValueWrites,
"Number of scalar value writes after DeLICM");
71 "Number of scalar value writes nested in affine loops after DeLICM");
72STATISTIC(NumPHIWrites,
"Number of scalar phi writes after DeLICM");
74 "Number of scalar phi writes nested in affine loops after DeLICM");
75STATISTIC(NumSingletonWrites,
"Number of singleton writes after DeLICM");
77 "Number of singleton writes nested in affine loops after DeLICM");
103 bool InclOverwrite) {
109 auto Result = computeReachingOverwrite(
110 std::move(Schedule), std::move(WritesMap), InclPrevWrite, InclOverwrite);
112 return Result.domain_factor_range();
125 isl::set Writes,
bool InclPrevWrite,
126 bool InclOverwrite) {
134 return singleton(std::move(ReachOverwrite), ResultSpace);
189class Knowledge final {
242 void checkConsistency()
const {
258 auto Universe = Occupied.
unite(Unused);
273 : Occupied(std::move(Occupied)), Unused(std::move(Unused)),
274 Known(std::move(Known)), Written(std::move(Written)) {
279 bool isUsable()
const {
285 void print(llvm::raw_ostream &OS,
unsigned Indent = 0)
const {
288 OS.indent(Indent) <<
"Occupied: " << Occupied <<
"\n";
290 OS.indent(Indent) <<
"Occupied: <Everything else not in Unused>\n";
292 OS.indent(Indent) <<
"Unused: " << Unused <<
"\n";
294 OS.indent(Indent) <<
"Unused: <Everything else not in Occupied>\n";
295 OS.indent(Indent) <<
"Known: " << Known <<
"\n";
296 OS.indent(Indent) <<
"Written : " << Written <<
'\n';
298 OS.indent(Indent) <<
"Invalid knowledge\n";
303 void learnFrom(Knowledge That) {
308 "This function is only prepared to learn occupied elements from That");
309 assert(Occupied.
is_null() &&
"This function does not implement "
311 "this->Occupied.unite(That.Occupied);`");
313 Unused = Unused.
subtract(That.Occupied);
314 Known = Known.
unite(That.Known);
315 Written = Written.
unite(That.Written);
339 const Knowledge &Proposed,
340 llvm::raw_ostream *OS =
nullptr,
341 unsigned Indent = 0) {
347 auto ExistingUniverse = Existing.Occupied.
unite(Existing.Unused);
348 auto ProposedUniverse = Proposed.Occupied.
unite(Proposed.Unused);
349 assert(ExistingUniverse.is_equal(ProposedUniverse) &&
350 "Both inputs' Knowledges must be over the same universe");
379 auto ProposedValues = Proposed.Known.
unite(ProposedOccupiedAnyVal);
382 auto ExistingValues = Existing.Known.
unite(ExistingUnusedAnyVal);
384 auto MatchingVals = ExistingValues.
intersect(ProposedValues);
385 auto Matches = MatchingVals.
domain();
390 if (!Proposed.Occupied.
is_subset(Matches)) {
392 auto Conflicting = Proposed.Occupied.
subtract(Matches);
393 auto ExistingConflictingKnown =
395 auto ProposedConflictingKnown =
398 OS->indent(Indent) <<
"Proposed lifetime conflicting with Existing's\n";
399 OS->indent(Indent) <<
"Conflicting occupied: " << Conflicting <<
"\n";
400 if (!ExistingConflictingKnown.is_empty())
402 <<
"Existing Known: " << ExistingConflictingKnown <<
"\n";
403 if (!ProposedConflictingKnown.is_empty())
405 <<
"Proposed Known: " << ProposedConflictingKnown <<
"\n";
429 auto ProposedFixedDefs =
431 auto ProposedFixedKnown =
434 auto ExistingConflictingWrites =
436 auto ExistingConflictingWritesDomain = ExistingConflictingWrites.
domain();
438 auto CommonWrittenVal =
439 ProposedFixedKnown.
intersect(ExistingConflictingWrites);
440 auto CommonWrittenValDomain = CommonWrittenVal.domain();
442 if (!ExistingConflictingWritesDomain.is_subset(CommonWrittenValDomain)) {
444 auto ExistingConflictingWritten =
445 ExistingConflictingWrites.subtract_domain(CommonWrittenValDomain);
446 auto ProposedConflictingKnown = ProposedFixedKnown.subtract_domain(
447 ExistingConflictingWritten.domain());
450 <<
"Proposed a lifetime where there is an Existing write into it\n";
451 OS->indent(Indent) <<
"Existing conflicting writes: "
452 << ExistingConflictingWritten <<
"\n";
453 if (!ProposedConflictingKnown.is_empty())
455 <<
"Proposed conflicting known: " << ProposedConflictingKnown
462 auto ExistingAvailableDefs =
464 auto ExistingKnownDefs =
467 auto ProposedWrittenDomain = Proposed.Written.
domain();
468 auto KnownIdentical = ExistingKnownDefs.
intersect(Proposed.Written);
469 auto IdenticalOrUnused =
470 ExistingAvailableDefs.
unite(KnownIdentical.domain());
471 if (!ProposedWrittenDomain.is_subset(IdenticalOrUnused)) {
473 auto Conflicting = ProposedWrittenDomain.subtract(IdenticalOrUnused);
474 auto ExistingConflictingKnown =
475 ExistingKnownDefs.intersect_domain(Conflicting);
476 auto ProposedConflictingWritten =
479 OS->indent(Indent) <<
"Proposed writes into range used by Existing\n";
480 OS->indent(Indent) <<
"Proposed conflicting writes: "
481 << ProposedConflictingWritten <<
"\n";
482 if (!ExistingConflictingKnown.is_empty())
484 <<
"Existing conflicting known: " << ExistingConflictingKnown
492 auto ExistingWrittenDomain = Existing.Written.
domain();
498 ExistingKnownWritten.intersect(ProposedKnownWritten).domain();
500 if (!BothWritten.is_subset(CommonWritten)) {
502 auto Conflicting = BothWritten.subtract(CommonWritten);
503 auto ExistingConflictingWritten =
505 auto ProposedConflictingWritten =
508 OS->indent(Indent) <<
"Proposed writes at the same time as an already "
510 OS->indent(Indent) <<
"Conflicting writes: " << Conflicting <<
"\n";
511 if (!ExistingConflictingWritten.is_empty())
513 <<
"Exiting write: " << ExistingConflictingWritten <<
"\n";
514 if (!ProposedConflictingWritten.is_empty())
516 <<
"Proposed write: " << ProposedConflictingWritten <<
"\n";
529 Knowledge OriginalZone;
536 int NumberOfCompatibleTargets = 0;
540 int NumberOfTargetsMapped = 0;
543 int NumberOfMappedValueScalars = 0;
546 int NumberOfMappedPHIScalars = 0;
552 raw_ostream *OS =
nullptr;
554 return Knowledge::isConflicting(Zone, Proposed, OS, 4);
563 auto *MA =
S->getValueDef(SAI);
567 <<
" Reject because value is read-only within the scop\n");
575 auto Inst = MA->getAccessInstruction();
576 for (
auto User : Inst->users()) {
577 if (!isa<Instruction>(User))
579 auto UserInst = cast<Instruction>(User);
581 if (!
S->contains(UserInst)) {
582 POLLY_DEBUG(dbgs() <<
" Reject because value is escaping\n");
591 auto *MA =
S->getPHIRead(SAI);
596 auto PHI = cast<PHINode>(MA->getAccessInstruction());
597 for (
auto Incoming :
PHI->blocks()) {
598 if (!
S->contains(Incoming)) {
600 <<
" Reject because at least one incoming block is "
601 "not in the scop region\n");
609 POLLY_DEBUG(dbgs() <<
" Reject ExitPHI or other non-value\n");
621 std::tuple<isl::union_map, isl::map>
626 auto Reads = makeEmptyUnionSet();
629 for (
auto *MA :
S->getValueUses(SAI))
630 Reads = Reads.unite(getDomainFor(MA));
633 auto ReadSchedule = getScatterFor(Reads);
635 auto *DefMA =
S->getValueDef(SAI);
639 auto Writes = getDomainFor(DefMA);
642 auto WriteScatter = getScatterFor(Writes);
645 auto ReachDef = getScalarReachingDefinition(DefMA->getStatement());
657 auto Lifetime =
betweenScatter(WriteScatter, UseScatter,
false,
true);
660 auto DefUses = Uses.domain_factor_domain();
662 return std::make_pair(DefUses, Lifetime);
675 auto *DefMA =
S->getValueDef(SAI);
676 assert(DefMA->isValueKind());
677 assert(DefMA->isMustWrite());
678 auto *V = DefMA->getAccessValue();
679 auto *DefInst = DefMA->getAccessInstruction();
682 if (!DefMA->getLatestScopArrayInfo()->isValueKind())
686 auto DefSched = getScatterFor(DefMA);
690 auto DefTarget = TargetElt.
apply_domain(DefSched.reverse());
692 POLLY_DEBUG(dbgs() <<
" Def Mapping: " << DefTarget <<
'\n');
694 auto OrigDomain = getDomainFor(DefMA);
695 auto MappedDomain = DefTarget.domain();
696 if (!OrigDomain.is_subset(MappedDomain)) {
699 <<
" Reject because mapping does not encompass all instances\n");
709 std::tie(DefUses, Lifetime) = computeValueUses(SAI);
710 POLLY_DEBUG(dbgs() <<
" Lifetime: " << Lifetime <<
'\n');
720 if (DelicmComputeKnown)
721 ValInst = makeValInst(V, DefMA->getStatement(),
722 LI->getLoopFor(DefInst->getParent()));
727 auto EltKnownTranslator = DefTarget.range_product(Lifetime);
730 auto EltKnown = ValInst.
apply_domain(EltKnownTranslator);
734 auto WrittenTranslator = DefTarget.range_product(DefSched);
737 auto DefEltSched = ValInst.
apply_domain(WrittenTranslator);
747 mapValue(SAI, std::move(DefTarget), std::move(UseTarget),
748 std::move(Lifetime), std::move(Proposed));
753 void applyLifetime(Knowledge Proposed) {
754 Zone.learnFrom(std::move(Proposed));
773 Knowledge Proposed) {
775 for (
auto *MA :
S->getValueUses(SAI)) {
777 auto Domain = getDomainFor(MA);
787 auto *WA =
S->getValueDef(SAI);
788 WA->setNewAccessRelation(DefTarget);
789 applyLifetime(Proposed);
791 MappedValueScalars++;
792 NumberOfMappedValueScalars += 1;
796 bool IsCertain =
true) {
799 if (!DelicmComputeKnown)
811 auto Result = makeEmptyUnionMap();
814 for (
auto *MA :
S->getPHIIncomings(SAI)) {
817 auto *WriteStmt = MA->getStatement();
819 auto Incoming = MA->getIncoming();
820 assert(!Incoming.empty());
821 if (Incoming.size() == 1) {
822 ValInst = makeValInst(Incoming[0].second, WriteStmt,
823 LI->getLoopFor(Incoming[0].first));
833 Result = Result.unite(ValInst);
836 assert(Result.is_single_valued() &&
837 "Cannot have multiple incoming values for same incoming statement");
850 auto *PHIRead =
S->getPHIRead(SAI);
851 assert(PHIRead->isPHIKind());
852 assert(PHIRead->isRead());
855 if (!PHIRead->getLatestScopArrayInfo()->isPHIKind())
859 auto PHISched = getScatterFor(PHIRead);
862 auto PHITarget = PHISched.apply_range(TargetElt);
864 POLLY_DEBUG(dbgs() <<
" Mapping: " << PHITarget <<
'\n');
866 auto OrigDomain = getDomainFor(PHIRead);
867 auto MappedDomain = PHITarget.domain();
868 if (!OrigDomain.is_subset(MappedDomain)) {
871 <<
" Reject because mapping does not encompass all instances\n");
876 auto PerPHIWrites = computePerPHI(SAI);
877 if (PerPHIWrites.is_null()) {
879 dbgs() <<
" Reject because cannot determine incoming values\n");
884 auto WritesTarget = PerPHIWrites.apply_domain(PHITarget).reverse();
890 for (
auto *MA :
S->getPHIIncomings(SAI))
891 UniverseWritesDom = UniverseWritesDom.unite(getDomainFor(MA));
893 auto RelevantWritesTarget = WritesTarget;
894 if (DelicmOverapproximateWrites)
895 WritesTarget = expandMapping(WritesTarget, UniverseWritesDom);
897 auto ExpandedWritesDom = WritesTarget.domain();
898 if (!DelicmPartialWrites &&
899 !UniverseWritesDom.is_subset(ExpandedWritesDom)) {
901 dbgs() <<
" Reject because did not find PHI write mapping for "
903 if (DelicmOverapproximateWrites)
905 << RelevantWritesTarget <<
'\n');
906 POLLY_DEBUG(dbgs() <<
" Deduced Mapping: " << WritesTarget
909 << UniverseWritesDom.subtract(ExpandedWritesDom)
920 auto Lifetime =
betweenScatter(PerPHIWriteScatter, PHISched,
false,
true);
922 POLLY_DEBUG(dbgs() <<
" Lifetime: " << Lifetime <<
"\n");
928 auto WrittenValue = determinePHIWrittenValues(SAI);
931 auto WrittenTranslator = WritesTarget.range_product(Schedule);
934 auto Written = WrittenValue.apply_domain(WrittenTranslator);
938 auto LifetimeTranslator = WritesTarget.range_product(WriteLifetime);
944 auto EltLifetimeInst = WrittenKnownValue.apply_domain(LifetimeTranslator);
948 auto Occupied = LifetimeTranslator.range();
951 Knowledge Proposed(Occupied, {}, EltLifetimeInst, Written);
955 mapPHI(SAI, std::move(PHITarget), std::move(WritesTarget),
956 std::move(Lifetime), std::move(Proposed));
976 Knowledge Proposed) {
981 for (
auto *MA :
S->getPHIIncomings(SAI)) {
983 auto Domain = getDomainFor(MA);
990 Domain.get_space().map_from_domain_and_range(ElementSpace);
992 MA->setNewAccessRelation(NewAccRelMap);
996 auto *PHIRead =
S->getPHIRead(SAI);
997 PHIRead->setNewAccessRelation(ReadTarget);
998 applyLifetime(Proposed);
1001 NumberOfMappedPHIScalars++;
1014 bool collapseScalarsToStore(
MemoryAccess *TargetStoreMA) {
1021 auto TargetDom = getDomainFor(TargetStmt);
1024 auto TargetAccRel = getAccessRelationFor(TargetStoreMA);
1029 computeScalarReachingOverwrite(Schedule, TargetDom,
false,
true);
1033 auto EltTarget = Target.apply_range(TargetAccRel);
1035 POLLY_DEBUG(dbgs() <<
" Target mapping is " << EltTarget <<
'\n');
1038 SmallVector<MemoryAccess *, 16> Worklist;
1041 SmallPtrSet<const ScopArrayInfo *, 16> Closed;
1044 auto ProcessAllIncoming = [&](
ScopStmt *Stmt) {
1045 for (
auto *MA : *Stmt) {
1046 if (!MA->isLatestScalarKind())
1051 Worklist.push_back(MA);
1056 if (
auto *WrittenValInputMA = TargetStmt->lookupInputAccessOf(WrittenVal))
1057 Worklist.push_back(WrittenValInputMA);
1059 ProcessAllIncoming(TargetStmt);
1061 auto AnyMapped =
false;
1062 auto &DL =
S->getRegion().getEntry()->getModule()->getDataLayout();
1066 while (!Worklist.empty()) {
1067 auto *MA = Worklist.pop_back_val();
1069 auto *SAI = MA->getScopArrayInfo();
1070 if (Closed.count(SAI))
1073 POLLY_DEBUG(dbgs() <<
"\n Trying to map " << MA <<
" (SAI: " << SAI
1077 if (!isMappable(SAI))
1080 auto MASize = DL.getTypeAllocSize(MA->getAccessValue()->getType());
1081 if (MASize > StoreSize) {
1083 dbgs() <<
" Reject because storage size is insufficient\n");
1089 if (!tryMapValue(SAI, EltTarget))
1092 auto *DefAcc =
S->getValueDef(SAI);
1093 ProcessAllIncoming(DefAcc->getStatement());
1101 if (!tryMapPHI(SAI, EltTarget))
1105 for (
auto *PHIWrite :
S->getPHIIncomings(SAI)) {
1106 auto *PHIWriteStmt = PHIWrite->getStatement();
1107 bool FoundAny =
false;
1108 for (
auto Incoming : PHIWrite->getIncoming()) {
1109 auto *IncomingInputMA =
1110 PHIWriteStmt->lookupInputAccessOf(Incoming.second);
1111 if (!IncomingInputMA)
1114 Worklist.push_back(IncomingInputMA);
1119 ProcessAllIncoming(PHIWrite->getStatement());
1129 NumberOfTargetsMapped++;
1140 false,
false,
true);
1142 auto Result = ArrayUnused.wrap();
1170 auto Map = getAccessRelationFor(MA);
1171 auto Set = Map.range();
1172 return Set.is_singleton();
1176 void printStatistics(llvm::raw_ostream &OS,
int Indent = 0)
const {
1177 OS.indent(Indent) <<
"Statistics {\n";
1178 OS.indent(Indent + 4) <<
"Compatible overwrites: "
1179 << NumberOfCompatibleTargets <<
"\n";
1180 OS.indent(Indent + 4) <<
"Overwrites mapped to: " << NumberOfTargetsMapped
1182 OS.indent(Indent + 4) <<
"Value scalars mapped: "
1183 << NumberOfMappedValueScalars <<
'\n';
1184 OS.indent(Indent + 4) <<
"PHI scalars mapped: "
1185 << NumberOfMappedPHIScalars <<
'\n';
1186 OS.indent(Indent) <<
"}\n";
1195 bool computeZone() {
1197 collectCompatibleElts();
1207 EltUnused = computeLifetime();
1208 EltKnown = computeKnown(
true,
false);
1209 EltWritten = computeWritten();
1215 "The only reason that these things have not been computed should "
1216 "be if the max-operations limit hit");
1218 POLLY_DEBUG(dbgs() <<
"DeLICM analysis exceeded max_operations\n");
1219 DebugLoc Begin, End;
1221 OptimizationRemarkAnalysis R(
DEBUG_TYPE,
"OutOfQuota", Begin,
1223 R <<
"maximal number of operations exceeded during zone analysis";
1224 S->getFunction().getContext().diagnose(R);
1228 Zone = OriginalZone = Knowledge({}, EltUnused, EltKnown, EltWritten);
1229 POLLY_DEBUG(dbgs() <<
"Computed Zone:\n"; OriginalZone.print(dbgs(), 4));
1231 assert(Zone.isUsable() && OriginalZone.isUsable());
1240 void greedyCollapse() {
1241 bool Modified =
false;
1243 for (
auto &Stmt : *
S) {
1244 for (
auto *MA : Stmt) {
1252 <<
" pruned because it is a MAY_WRITE\n");
1253 OptimizationRemarkMissed R(
DEBUG_TYPE,
"TargetMayWrite",
1255 R <<
"Skipped possible mapping target because it is not an "
1256 "unconditional overwrite";
1257 S->getFunction().getContext().diagnose(R);
1261 if (Stmt.getNumIterators() == 0) {
1263 <<
" pruned because it is not in a loop\n");
1264 OptimizationRemarkMissed R(
DEBUG_TYPE,
"WriteNotInLoop",
1266 R <<
"skipped possible mapping target because it is not in a loop";
1267 S->getFunction().getContext().diagnose(R);
1271 if (isScalarAccess(MA)) {
1274 <<
" pruned because it writes only a single element\n");
1275 OptimizationRemarkMissed R(
DEBUG_TYPE,
"ScalarWrite",
1277 R <<
"skipped possible mapping target because the memory location "
1278 "written to does not depend on its outer loop";
1279 S->getFunction().getContext().diagnose(R);
1285 <<
" pruned because it is not a StoreInst\n");
1286 OptimizationRemarkMissed R(
DEBUG_TYPE,
"NotAStore",
1288 R <<
"skipped possible mapping target because non-store instructions "
1289 "are not supported";
1290 S->getFunction().getContext().diagnose(R);
1308 <<
" is incompatible because it writes multiple "
1309 "elements per instance\n");
1310 OptimizationRemarkMissed R(
DEBUG_TYPE,
"NonFunctionalAccRel",
1312 R <<
"skipped possible mapping target because it writes more than "
1314 S->getFunction().getContext().diagnose(R);
1319 if (!TouchedElts.
is_subset(CompatibleElts)) {
1323 <<
" is incompatible because it touches incompatible elements\n");
1324 OptimizationRemarkMissed R(
DEBUG_TYPE,
"IncompatibleElts",
1326 R <<
"skipped possible mapping target because a target location "
1327 "cannot be reliably analyzed";
1328 S->getFunction().getContext().diagnose(R);
1332 assert(isCompatibleAccess(MA));
1333 NumberOfCompatibleTargets++;
1334 POLLY_DEBUG(dbgs() <<
"Analyzing target access " << MA <<
"\n");
1335 if (collapseScalarsToStore(MA))
1341 DeLICMScopsModified++;
1345 void print(llvm::raw_ostream &OS,
int Indent = 0) {
1346 if (!Zone.isUsable()) {
1347 OS.indent(Indent) <<
"Zone not computed\n";
1351 printStatistics(OS, Indent);
1352 if (!isModified()) {
1353 OS.indent(Indent) <<
"No modification has been made\n";
1356 printAccesses(OS, Indent);
1360 bool isModified()
const {
1361 return NumberOfTargetsMapped > 0 || NumberOfMappedValueScalars > 0 ||
1362 NumberOfMappedPHIScalars > 0;
1366static std::unique_ptr<DeLICMImpl> collapseToUnused(
Scop &
S, LoopInfo &LI) {
1367 std::unique_ptr<DeLICMImpl> Impl = std::make_unique<DeLICMImpl>(&
S, &LI);
1369 if (!Impl->computeZone()) {
1370 POLLY_DEBUG(dbgs() <<
"Abort because cannot reliably compute lifetimes\n");
1374 POLLY_DEBUG(dbgs() <<
"Collapsing scalars to unused array elements...\n");
1375 Impl->greedyCollapse();
1383static std::unique_ptr<DeLICMImpl> runDeLICMImpl(
Scop &
S, LoopInfo &LI) {
1384 std::unique_ptr<DeLICMImpl> Impl = collapseToUnused(
S, LI);
1403 llvm::raw_ostream *OS,
unsigned Indent) {
1404 Knowledge Existing(std::move(ExistingOccupied), std::move(ExistingUnused),
1405 std::move(ExistingKnown), std::move(ExistingWrites));
1406 Knowledge Proposed(std::move(ProposedOccupied), std::move(ProposedUnused),
1407 std::move(ProposedKnown), std::move(ProposedWrites));
1409 return Knowledge::isConflicting(Existing, Proposed, OS, Indent);
1413 LoopInfo &LI = *
S.getLI();
1414 std::unique_ptr<DeLICMImpl> Impl = runDeLICMImpl(
S, LI);
1416 if (PollyPrintDeLICM) {
1417 outs() <<
"Printing analysis 'Polly - DeLICM/DePRE' for region: '"
1418 <<
S.getName() <<
"' in function '" <<
S.getFunction().getName()
1421 assert(Impl->getScop() == &
S);
1423 outs() <<
"DeLICM result:\n";
1424 Impl->print(outs());
1428 return Impl->isModified();
llvm::cl::OptionCategory PollyCategory
STATISTIC(ScopFound, "Number of valid Scops")
static isl::map from_union_map(isl::union_map umap)
isl::map apply_domain(isl::map map2) const
isl::space get_space() const
isl::space map_from_domain_and_range(isl::space range) const
isl::union_set range() const
isl::union_map reverse() const
isl::union_map gist_domain(isl::union_set uset) const
isl::union_map unite(isl::union_map umap2) const
isl::union_set domain() const
isl::space get_space() const
isl::union_map apply_domain(isl::union_map umap2) const
static isl::union_map from_domain(isl::union_set uset)
isl::union_map coalesce() const
isl::union_map apply_range(isl::union_map umap2) const
boolean is_single_valued() const
isl::union_map intersect(isl::union_map umap2) const
isl::union_map intersect_domain(isl::space space) const
static isl::union_set empty(isl::ctx ctx)
boolean is_disjoint(const isl::union_set &uset2) const
isl::union_set subtract(isl::union_set uset2) const
boolean is_subset(const isl::union_set &uset2) const
isl::union_set intersect(isl::union_set uset2) const
isl::union_set unite(isl::union_set uset2) const
Scoped limit of ISL operations.
Represent memory accesses in statements.
isl::map getLatestAccessRelation() const
Return the newest access relation of this access.
bool isLatestArrayKind() const
Whether storage memory is either an custom .s2a/.phiops alloca (false) or an existing pointer into an...
bool isWrite() const
Is this a write memory access?
Instruction * getAccessInstruction() const
Return the access instruction of this memory access.
bool isMustWrite() const
Is this a must-write memory access?
ScopStmt * getStatement() const
Get the statement that contains this memory access.
bool isMayWrite() const
Is this a may-write memory access?
Value * getAccessValue() const
Return the access value of this memory access.
A class to store information about arrays in the SCoP.
bool isValueKind() const
Is this array info modeling an llvm::Value?
bool isPHIKind() const
Is this array info modeling special PHI node memory?
Base class for algorithms based on zones, like DeLICM.
isl::map makeValInst(llvm::Value *Val, ScopStmt *UserStmt, llvm::Loop *Scope, bool IsCertain=true)
Create a mapping from a statement instance to the instance of an llvm::Value that can be used in ther...
enum isl_error isl_ctx_last_error(isl_ctx *ctx)
isl::map betweenScatter(isl::map From, isl::map To, bool InclFrom, bool InclTo)
Construct a range of timepoints between two timepoints.
isl::union_map makeUnknownForDomain(isl::union_set Domain)
Create a domain-to-unknown value mapping.
isl::union_map computeReachingWrite(isl::union_map Schedule, isl::union_map Writes, bool Reverse, bool InclPrevDef, bool InclNextDef)
Compute the reaching definition statement or the next overwrite for each definition of an array eleme...
isl::union_map computeArrayUnused(isl::union_map Schedule, isl::union_map Writes, isl::union_map Reads, bool ReadEltInSameInst, bool InclLastRead, bool InclWrite)
Compute the timepoints where the contents of an array element are not used.
void getDebugLocations(const BBPair &P, DebugLoc &Begin, DebugLoc &End)
Set the begin and end source location for the region limited by P.
@ Value
MemoryKind::Value: Models an llvm::Value.
@ PHI
MemoryKind::PHI: Models PHI nodes within the SCoP.
bool isConflicting(isl::union_set ExistingOccupied, isl::union_set ExistingUnused, isl::union_map ExistingKnown, isl::union_map ExistingWrites, isl::union_set ProposedOccupied, isl::union_set ProposedUnused, isl::union_map ProposedKnown, isl::union_map ProposedWrites, llvm::raw_ostream *OS=nullptr, unsigned Indent=0)
Determine whether two lifetimes are conflicting.
void simplify(isl::set &Set)
Simplify a set inplace.
BBPair getBBPairForRegion(const Region *R)
Return the region delimiters (entry & exit block) of R.
isl::union_map applyDomainRange(isl::union_map UMap, isl::union_map Func)
Apply a map to the 'middle' of another relation.
isl::union_set convertZoneToTimepoints(isl::union_set Zone, bool InclStart, bool InclEnd)
Convert a zone (range between timepoints) to timepoints.
isl::map singleton(isl::union_map UMap, isl::space ExpectedSpace)
If by construction a union map is known to contain only a single map, return it.
isl::union_map filterKnownValInst(const isl::union_map &UMap)
Return only the mappings that map to known values.
isl::space getScatterSpace(const isl::union_map &Schedule)
Return the scatter space of a Schedule.
int NumValueWritesInLoops
int NumSingletonWritesInLoops
static TupleKindPtr Domain("Domain")
isl_size isl_union_map_n_map(__isl_keep isl_union_map *umap)