summaryrefslogtreecommitdiffstats
path: root/polly/lib/Transform
diff options
context:
space:
mode:
authorNicola Zaghen <nicola.zaghen@imgtec.com>2018-05-15 13:37:17 +0000
committerNicola Zaghen <nicola.zaghen@imgtec.com>2018-05-15 13:37:17 +0000
commit349506a926c78af36cdcac75d44ac7522f168d06 (patch)
treee3d1f236a6bf854d438b9d8a824c7a4d676d0e0e /polly/lib/Transform
parente7245b429b942946ed3cb8f422b22e3de6d00a3c (diff)
downloadbcm5719-llvm-349506a926c78af36cdcac75d44ac7522f168d06.tar.gz
bcm5719-llvm-349506a926c78af36cdcac75d44ac7522f168d06.zip
[polly] Update uses of DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Differential Revision: https://reviews.llvm.org/D44978 llvm-svn: 332352
Diffstat (limited to 'polly/lib/Transform')
-rw-r--r--polly/lib/Transform/DeLICM.cpp99
-rw-r--r--polly/lib/Transform/FlattenAlgo.cpp33
-rw-r--r--polly/lib/Transform/FlattenSchedule.cpp16
-rw-r--r--polly/lib/Transform/ForwardOpTree.cpp45
-rw-r--r--polly/lib/Transform/ScheduleOptimizer.cpp14
-rw-r--r--polly/lib/Transform/ScopInliner.cpp12
-rw-r--r--polly/lib/Transform/Simplify.cpp42
-rw-r--r--polly/lib/Transform/ZoneAlgo.cpp7
8 files changed, 143 insertions, 125 deletions
diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp
index 600e4a88de7..fde99a28660 100644
--- a/polly/lib/Transform/DeLICM.cpp
+++ b/polly/lib/Transform/DeLICM.cpp
@@ -540,7 +540,7 @@ private:
/// @see Knowledge::isConflicting
bool isConflicting(const Knowledge &Proposed) {
raw_ostream *OS = nullptr;
- DEBUG(OS = &llvm::dbgs());
+ LLVM_DEBUG(OS = &llvm::dbgs());
return Knowledge::isConflicting(Zone, Proposed, OS, 4);
}
@@ -552,8 +552,9 @@ private:
if (SAI->isValueKind()) {
auto *MA = S->getValueDef(SAI);
if (!MA) {
- DEBUG(dbgs()
- << " Reject because value is read-only within the scop\n");
+ LLVM_DEBUG(
+ dbgs()
+ << " Reject because value is read-only within the scop\n");
return false;
}
@@ -568,7 +569,7 @@ private:
auto UserInst = cast<Instruction>(User);
if (!S->contains(UserInst)) {
- DEBUG(dbgs() << " Reject because value is escaping\n");
+ LLVM_DEBUG(dbgs() << " Reject because value is escaping\n");
return false;
}
}
@@ -585,8 +586,9 @@ private:
auto PHI = cast<PHINode>(MA->getAccessInstruction());
for (auto Incoming : PHI->blocks()) {
if (!S->contains(Incoming)) {
- DEBUG(dbgs() << " Reject because at least one incoming block is "
- "not in the scop region\n");
+ LLVM_DEBUG(dbgs()
+ << " Reject because at least one incoming block is "
+ "not in the scop region\n");
return false;
}
}
@@ -594,7 +596,7 @@ private:
return true;
}
- DEBUG(dbgs() << " Reject ExitPHI or other non-value\n");
+ LLVM_DEBUG(dbgs() << " Reject ExitPHI or other non-value\n");
return false;
}
@@ -677,13 +679,14 @@ private:
// { DomainDef[] -> Element[] }
auto DefTarget = TargetElt.apply_domain(DefSched.reverse());
simplify(DefTarget);
- DEBUG(dbgs() << " Def Mapping: " << DefTarget << '\n');
+ LLVM_DEBUG(dbgs() << " Def Mapping: " << DefTarget << '\n');
auto OrigDomain = getDomainFor(DefMA);
auto MappedDomain = DefTarget.domain();
if (!OrigDomain.is_subset(MappedDomain)) {
- DEBUG(dbgs()
- << " Reject because mapping does not encompass all instances\n");
+ LLVM_DEBUG(
+ dbgs()
+ << " Reject because mapping does not encompass all instances\n");
return false;
}
@@ -694,7 +697,7 @@ private:
isl::union_map DefUses;
std::tie(DefUses, Lifetime) = computeValueUses(SAI);
- DEBUG(dbgs() << " Lifetime: " << Lifetime << '\n');
+ LLVM_DEBUG(dbgs() << " Lifetime: " << Lifetime << '\n');
/// { [Element[] -> Zone[]] }
auto EltZone = Lifetime.apply_domain(DefTarget).wrap();
@@ -849,13 +852,14 @@ private:
// { DomainRead[] -> Element[] }
auto PHITarget = PHISched.apply_range(TargetElt);
simplify(PHITarget);
- DEBUG(dbgs() << " Mapping: " << PHITarget << '\n');
+ LLVM_DEBUG(dbgs() << " Mapping: " << PHITarget << '\n');
auto OrigDomain = getDomainFor(PHIRead);
auto MappedDomain = PHITarget.domain();
if (!OrigDomain.is_subset(MappedDomain)) {
- DEBUG(dbgs()
- << " Reject because mapping does not encompass all instances\n");
+ LLVM_DEBUG(
+ dbgs()
+ << " Reject because mapping does not encompass all instances\n");
return false;
}
@@ -879,14 +883,17 @@ private:
auto ExpandedWritesDom = WritesTarget.domain();
if (!DelicmPartialWrites &&
!UniverseWritesDom.is_subset(ExpandedWritesDom)) {
- DEBUG(dbgs() << " Reject because did not find PHI write mapping for "
- "all instances\n");
+ LLVM_DEBUG(
+ dbgs() << " Reject because did not find PHI write mapping for "
+ "all instances\n");
if (DelicmOverapproximateWrites)
- DEBUG(dbgs() << " Relevant Mapping: " << RelevantWritesTarget
- << '\n');
- DEBUG(dbgs() << " Deduced Mapping: " << WritesTarget << '\n');
- DEBUG(dbgs() << " Missing instances: "
- << UniverseWritesDom.subtract(ExpandedWritesDom) << '\n');
+ LLVM_DEBUG(dbgs() << " Relevant Mapping: "
+ << RelevantWritesTarget << '\n');
+ LLVM_DEBUG(dbgs() << " Deduced Mapping: " << WritesTarget
+ << '\n');
+ LLVM_DEBUG(dbgs() << " Missing instances: "
+ << UniverseWritesDom.subtract(ExpandedWritesDom)
+ << '\n');
return false;
}
@@ -897,7 +904,7 @@ private:
// { DomainRead[] -> Zone[] }
auto Lifetime = betweenScatter(PerPHIWriteScatter, PHISched, false, true);
simplify(Lifetime);
- DEBUG(dbgs() << " Lifetime: " << Lifetime << "\n");
+ LLVM_DEBUG(dbgs() << " Lifetime: " << Lifetime << "\n");
// { DomainWrite[] -> Zone[] }
auto WriteLifetime = isl::union_map(Lifetime).apply_domain(PerPHIWrites);
@@ -1010,7 +1017,7 @@ private:
// Use the target store's write location as a suggestion to map scalars to.
auto EltTarget = Target.apply_range(TargetAccRel);
simplify(EltTarget);
- DEBUG(dbgs() << " Target mapping is " << EltTarget << '\n');
+ LLVM_DEBUG(dbgs() << " Target mapping is " << EltTarget << '\n');
// Stack of elements not yet processed.
SmallVector<MemoryAccess *, 16> Worklist;
@@ -1048,8 +1055,8 @@ private:
if (Closed.count(SAI))
continue;
Closed.insert(SAI);
- DEBUG(dbgs() << "\n Trying to map " << MA << " (SAI: " << SAI
- << ")\n");
+ LLVM_DEBUG(dbgs() << "\n Trying to map " << MA << " (SAI: " << SAI
+ << ")\n");
// Skip non-mappable scalars.
if (!isMappable(SAI))
@@ -1057,7 +1064,8 @@ private:
auto MASize = DL.getTypeAllocSize(MA->getAccessValue()->getType());
if (MASize > StoreSize) {
- DEBUG(dbgs() << " Reject because storage size is insufficient\n");
+ LLVM_DEBUG(
+ dbgs() << " Reject because storage size is insufficient\n");
continue;
}
@@ -1195,7 +1203,7 @@ public:
"The only reason that these things have not been computed should "
"be if the max-operations limit hit");
DeLICMOutOfQuota++;
- DEBUG(dbgs() << "DeLICM analysis exceeded max_operations\n");
+ LLVM_DEBUG(dbgs() << "DeLICM analysis exceeded max_operations\n");
DebugLoc Begin, End;
getDebugLocations(getBBPairForRegion(&S->getRegion()), Begin, End);
OptimizationRemarkAnalysis R(DEBUG_TYPE, "OutOfQuota", Begin,
@@ -1206,7 +1214,7 @@ public:
}
Zone = OriginalZone = Knowledge(nullptr, EltUnused, EltKnown, EltWritten);
- DEBUG(dbgs() << "Computed Zone:\n"; OriginalZone.print(dbgs(), 4));
+ LLVM_DEBUG(dbgs() << "Computed Zone:\n"; OriginalZone.print(dbgs(), 4));
assert(Zone.isUsable() && OriginalZone.isUsable());
return true;
@@ -1228,8 +1236,8 @@ public:
continue;
if (MA->isMayWrite()) {
- DEBUG(dbgs() << "Access " << MA
- << " pruned because it is a MAY_WRITE\n");
+ LLVM_DEBUG(dbgs() << "Access " << MA
+ << " pruned because it is a MAY_WRITE\n");
OptimizationRemarkMissed R(DEBUG_TYPE, "TargetMayWrite",
MA->getAccessInstruction());
R << "Skipped possible mapping target because it is not an "
@@ -1239,8 +1247,8 @@ public:
}
if (Stmt.getNumIterators() == 0) {
- DEBUG(dbgs() << "Access " << MA
- << " pruned because it is not in a loop\n");
+ LLVM_DEBUG(dbgs() << "Access " << MA
+ << " pruned because it is not in a loop\n");
OptimizationRemarkMissed R(DEBUG_TYPE, "WriteNotInLoop",
MA->getAccessInstruction());
R << "skipped possible mapping target because it is not in a loop";
@@ -1249,8 +1257,9 @@ public:
}
if (isScalarAccess(MA)) {
- DEBUG(dbgs() << "Access " << MA
- << " pruned because it writes only a single element\n");
+ LLVM_DEBUG(dbgs()
+ << "Access " << MA
+ << " pruned because it writes only a single element\n");
OptimizationRemarkMissed R(DEBUG_TYPE, "ScalarWrite",
MA->getAccessInstruction());
R << "skipped possible mapping target because the memory location "
@@ -1260,8 +1269,8 @@ public:
}
if (!isa<StoreInst>(MA->getAccessInstruction())) {
- DEBUG(dbgs() << "Access " << MA
- << " pruned because it is not a StoreInst\n");
+ LLVM_DEBUG(dbgs() << "Access " << MA
+ << " pruned because it is not a StoreInst\n");
OptimizationRemarkMissed R(DEBUG_TYPE, "NotAStore",
MA->getAccessInstruction());
R << "skipped possible mapping target because non-store instructions "
@@ -1283,9 +1292,9 @@ public:
// arguments.
isl::union_map AccRel = MA->getLatestAccessRelation();
if (!AccRel.is_single_valued().is_true()) {
- DEBUG(dbgs() << "Access " << MA
- << " is incompatible because it writes multiple "
- "elements per instance\n");
+ LLVM_DEBUG(dbgs() << "Access " << MA
+ << " is incompatible because it writes multiple "
+ "elements per instance\n");
OptimizationRemarkMissed R(DEBUG_TYPE, "NonFunctionalAccRel",
MA->getAccessInstruction());
R << "skipped possible mapping target because it writes more than "
@@ -1296,7 +1305,7 @@ public:
isl::union_set TouchedElts = AccRel.range();
if (!TouchedElts.is_subset(CompatibleElts)) {
- DEBUG(
+ LLVM_DEBUG(
dbgs()
<< "Access " << MA
<< " is incompatible because it touches incompatible elements\n");
@@ -1310,7 +1319,7 @@ public:
assert(isCompatibleAccess(MA));
NumberOfCompatibleTargets++;
- DEBUG(dbgs() << "Analyzing target access " << MA << "\n");
+ LLVM_DEBUG(dbgs() << "Analyzing target access " << MA << "\n");
if (collapseScalarsToStore(MA))
Modified = true;
}
@@ -1349,15 +1358,15 @@ private:
Impl = make_unique<DeLICMImpl>(&S, &LI);
if (!Impl->computeZone()) {
- DEBUG(dbgs() << "Abort because cannot reliably compute lifetimes\n");
+ LLVM_DEBUG(dbgs() << "Abort because cannot reliably compute lifetimes\n");
return;
}
- DEBUG(dbgs() << "Collapsing scalars to unused array elements...\n");
+ LLVM_DEBUG(dbgs() << "Collapsing scalars to unused array elements...\n");
Impl->greedyCollapse();
- DEBUG(dbgs() << "\nFinal Scop:\n");
- DEBUG(dbgs() << S);
+ LLVM_DEBUG(dbgs() << "\nFinal Scop:\n");
+ LLVM_DEBUG(dbgs() << S);
}
public:
diff --git a/polly/lib/Transform/FlattenAlgo.cpp b/polly/lib/Transform/FlattenAlgo.cpp
index 02587221f49..fc88158bdeb 100644
--- a/polly/lib/Transform/FlattenAlgo.cpp
+++ b/polly/lib/Transform/FlattenAlgo.cpp
@@ -180,7 +180,7 @@ isl::union_map tryFlattenSequence(isl::union_map Schedule) {
// Would cause an infinite loop.
if (!isDimBoundedByConstant(ScatterSet, 0)) {
- DEBUG(dbgs() << "Abort; dimension is not of fixed size\n");
+ LLVM_DEBUG(dbgs() << "Abort; dimension is not of fixed size\n");
return nullptr;
}
@@ -191,8 +191,8 @@ isl::union_map tryFlattenSequence(isl::union_map Schedule) {
auto Counter = isl::pw_aff(isl::local_space(ParamSpace.set_from_params()));
while (!ScatterSet.is_empty()) {
- DEBUG(dbgs() << "Next counter:\n " << Counter << "\n");
- DEBUG(dbgs() << "Remaining scatter set:\n " << ScatterSet << "\n");
+ LLVM_DEBUG(dbgs() << "Next counter:\n " << Counter << "\n");
+ LLVM_DEBUG(dbgs() << "Remaining scatter set:\n " << ScatterSet << "\n");
auto ThisSet = ScatterSet.project_out(isl::dim::set, 1, Dims - 1);
auto ThisFirst = ThisSet.lexmin();
auto ScatterFirst = ThisFirst.add_dims(isl::dim::set, Dims - 1);
@@ -207,10 +207,11 @@ isl::union_map tryFlattenSequence(isl::union_map Schedule) {
auto RemainingSubSchedule = scheduleProjectOut(SubSchedule, 0, 1);
auto FirstSubScatter = isl::set(FirstSubSchedule.range());
- DEBUG(dbgs() << "Next step in sequence is:\n " << FirstSubScatter << "\n");
+ LLVM_DEBUG(dbgs() << "Next step in sequence is:\n " << FirstSubScatter
+ << "\n");
if (!isDimBoundedByParameter(FirstSubScatter, 0)) {
- DEBUG(dbgs() << "Abort; sequence step is not bounded\n");
+ LLVM_DEBUG(dbgs() << "Abort; sequence step is not bounded\n");
return nullptr;
}
@@ -241,7 +242,8 @@ isl::union_map tryFlattenSequence(isl::union_map Schedule) {
Counter = Counter.add(PartLen);
}
- DEBUG(dbgs() << "Sequence-flatten result is:\n " << NewSchedule << "\n");
+ LLVM_DEBUG(dbgs() << "Sequence-flatten result is:\n " << NewSchedule
+ << "\n");
return NewSchedule;
}
@@ -268,19 +270,19 @@ isl::union_map tryFlattenLoop(isl::union_map Schedule) {
SubExtent = SubExtent.project_out(isl::dim::set, 1, SubDims - 1);
if (!isDimBoundedByConstant(SubExtent, 0)) {
- DEBUG(dbgs() << "Abort; dimension not bounded by constant\n");
+ LLVM_DEBUG(dbgs() << "Abort; dimension not bounded by constant\n");
return nullptr;
}
auto Min = SubExtent.dim_min(0);
- DEBUG(dbgs() << "Min bound:\n " << Min << "\n");
+ LLVM_DEBUG(dbgs() << "Min bound:\n " << Min << "\n");
auto MinVal = getConstant(Min, false, true);
auto Max = SubExtent.dim_max(0);
- DEBUG(dbgs() << "Max bound:\n " << Max << "\n");
+ LLVM_DEBUG(dbgs() << "Max bound:\n " << Max << "\n");
auto MaxVal = getConstant(Max, true, false);
if (!MinVal || !MaxVal || MinVal.is_nan() || MaxVal.is_nan()) {
- DEBUG(dbgs() << "Abort; dimension bounds could not be determined\n");
+ LLVM_DEBUG(dbgs() << "Abort; dimension bounds could not be determined\n");
return nullptr;
}
@@ -298,14 +300,15 @@ isl::union_map tryFlattenLoop(isl::union_map Schedule) {
auto IndexMap = isl::union_map(Index);
auto Result = IndexMap.flat_range_product(RemainingSubSchedule);
- DEBUG(dbgs() << "Loop-flatten result is:\n " << Result << "\n");
+ LLVM_DEBUG(dbgs() << "Loop-flatten result is:\n " << Result << "\n");
return Result;
}
} // anonymous namespace
isl::union_map polly::flattenSchedule(isl::union_map Schedule) {
auto Dims = scheduleScatterDims(Schedule);
- DEBUG(dbgs() << "Recursive schedule to process:\n " << Schedule << "\n");
+ LLVM_DEBUG(dbgs() << "Recursive schedule to process:\n " << Schedule
+ << "\n");
// Base case; no dimensions left
if (Dims == 0) {
@@ -319,20 +322,20 @@ isl::union_map polly::flattenSchedule(isl::union_map Schedule) {
// Fixed dimension; no need to preserve variabledness.
if (!isVariableDim(Schedule)) {
- DEBUG(dbgs() << "Fixed dimension; try sequence flattening\n");
+ LLVM_DEBUG(dbgs() << "Fixed dimension; try sequence flattening\n");
auto NewScheduleSequence = tryFlattenSequence(Schedule);
if (NewScheduleSequence)
return NewScheduleSequence;
}
// Constant stride
- DEBUG(dbgs() << "Try loop flattening\n");
+ LLVM_DEBUG(dbgs() << "Try loop flattening\n");
auto NewScheduleLoop = tryFlattenLoop(Schedule);
if (NewScheduleLoop)
return NewScheduleLoop;
// Try again without loop condition (may blow up the number of pieces!!)
- DEBUG(dbgs() << "Try sequence flattening again\n");
+ LLVM_DEBUG(dbgs() << "Try sequence flattening again\n");
auto NewScheduleSequence = tryFlattenSequence(Schedule);
if (NewScheduleSequence)
return NewScheduleSequence;
diff --git a/polly/lib/Transform/FlattenSchedule.cpp b/polly/lib/Transform/FlattenSchedule.cpp
index 5bdb6abf91f..fb07af6b0d8 100644
--- a/polly/lib/Transform/FlattenSchedule.cpp
+++ b/polly/lib/Transform/FlattenSchedule.cpp
@@ -59,23 +59,23 @@ public:
// OldSchedule.
IslCtx = S.getSharedIslCtx();
- DEBUG(dbgs() << "Going to flatten old schedule:\n");
+ LLVM_DEBUG(dbgs() << "Going to flatten old schedule:\n");
OldSchedule = S.getSchedule();
- DEBUG(printSchedule(dbgs(), OldSchedule, 2));
+ LLVM_DEBUG(printSchedule(dbgs(), OldSchedule, 2));
auto Domains = S.getDomains();
auto RestrictedOldSchedule = OldSchedule.intersect_domain(Domains);
- DEBUG(dbgs() << "Old schedule with domains:\n");
- DEBUG(printSchedule(dbgs(), RestrictedOldSchedule, 2));
+ LLVM_DEBUG(dbgs() << "Old schedule with domains:\n");
+ LLVM_DEBUG(printSchedule(dbgs(), RestrictedOldSchedule, 2));
auto NewSchedule = flattenSchedule(RestrictedOldSchedule);
- DEBUG(dbgs() << "Flattened new schedule:\n");
- DEBUG(printSchedule(dbgs(), NewSchedule, 2));
+ LLVM_DEBUG(dbgs() << "Flattened new schedule:\n");
+ LLVM_DEBUG(printSchedule(dbgs(), NewSchedule, 2));
NewSchedule = NewSchedule.gist_domain(Domains);
- DEBUG(dbgs() << "Gisted, flattened new schedule:\n");
- DEBUG(printSchedule(dbgs(), NewSchedule, 2));
+ LLVM_DEBUG(dbgs() << "Gisted, flattened new schedule:\n");
+ LLVM_DEBUG(printSchedule(dbgs(), NewSchedule, 2));
S.setSchedule(NewSchedule);
return false;
diff --git a/polly/lib/Transform/ForwardOpTree.cpp b/polly/lib/Transform/ForwardOpTree.cpp
index 0cb8a3024c2..898533a8d43 100644
--- a/polly/lib/Transform/ForwardOpTree.cpp
+++ b/polly/lib/Transform/ForwardOpTree.cpp
@@ -298,12 +298,12 @@ public:
Known = nullptr;
Translator = nullptr;
NormalizeMap = nullptr;
- DEBUG(dbgs() << "Known analysis exceeded max_operations\n");
+ LLVM_DEBUG(dbgs() << "Known analysis exceeded max_operations\n");
return false;
}
KnownAnalyzed++;
- DEBUG(dbgs() << "All known: " << Known << "\n");
+ LLVM_DEBUG(dbgs() << "All known: " << Known << "\n");
return true;
}
@@ -491,12 +491,13 @@ public:
return FD_CanForwardProfitably;
if (Access) {
- DEBUG(dbgs() << " forwarded known load with preexisting MemoryAccess"
- << Access << "\n");
+ LLVM_DEBUG(
+ dbgs() << " forwarded known load with preexisting MemoryAccess"
+ << Access << "\n");
} else {
Access = makeReadArrayAccess(TargetStmt, LI, SameVal);
- DEBUG(dbgs() << " forwarded known load with new MemoryAccess" << Access
- << "\n");
+ LLVM_DEBUG(dbgs() << " forwarded known load with new MemoryAccess"
+ << Access << "\n");
// { ValInst[] }
isl::space ValInstSpace = ExpectedVal.get_space().range();
@@ -531,13 +532,14 @@ public:
isl::map LocalTranslator = DefToTarget.reverse().product(ValToVal);
Translator = Translator.add_map(LocalTranslator);
- DEBUG(dbgs() << " local translator is " << LocalTranslator
- << "\n");
+ LLVM_DEBUG(dbgs() << " local translator is " << LocalTranslator
+ << "\n");
}
}
- DEBUG(dbgs() << " expected values where " << TargetExpectedVal
- << "\n");
- DEBUG(dbgs() << " candidate elements where " << Candidates << "\n");
+ LLVM_DEBUG(dbgs() << " expected values where " << TargetExpectedVal
+ << "\n");
+ LLVM_DEBUG(dbgs() << " candidate elements where " << Candidates
+ << "\n");
assert(Access);
NumKnownLoadsForwarded++;
@@ -761,8 +763,9 @@ public:
if (TargetUse.getKind() == VirtualUse::Synthesizable)
return FD_CanForwardLeaf;
- DEBUG(dbgs() << " Synthesizable would not be synthesizable anymore: "
- << *UseVal << "\n");
+ LLVM_DEBUG(
+ dbgs() << " Synthesizable would not be synthesizable anymore: "
+ << *UseVal << "\n");
return FD_CannotForward;
}
@@ -834,7 +837,7 @@ public:
// When no method is found to forward the operand tree, we effectively
// cannot handle it.
- DEBUG(dbgs() << " Cannot forward instruction: " << *Inst << "\n");
+ LLVM_DEBUG(dbgs() << " Cannot forward instruction: " << *Inst << "\n");
return FD_CannotForward;
}
@@ -844,7 +847,7 @@ public:
/// Try to forward an operand tree rooted in @p RA.
bool tryForwardTree(MemoryAccess *RA) {
assert(RA->isLatestScalarKind());
- DEBUG(dbgs() << "Trying to forward operand tree " << RA << "...\n");
+ LLVM_DEBUG(dbgs() << "Trying to forward operand tree " << RA << "...\n");
ScopStmt *Stmt = RA->getStatement();
Loop *InLoop = Stmt->getSurroundingLoop();
@@ -966,22 +969,22 @@ public:
Impl = llvm::make_unique<ForwardOpTreeImpl>(&S, &LI, MaxOpGuard);
if (AnalyzeKnown) {
- DEBUG(dbgs() << "Prepare forwarders...\n");
+ LLVM_DEBUG(dbgs() << "Prepare forwarders...\n");
Impl->computeKnownValues();
}
- DEBUG(dbgs() << "Forwarding operand trees...\n");
+ LLVM_DEBUG(dbgs() << "Forwarding operand trees...\n");
Impl->forwardOperandTrees();
if (MaxOpGuard.hasQuotaExceeded()) {
- DEBUG(dbgs() << "Not all operations completed because of "
- "max_operations exceeded\n");
+ LLVM_DEBUG(dbgs() << "Not all operations completed because of "
+ "max_operations exceeded\n");
KnownOutOfQuota++;
}
}
- DEBUG(dbgs() << "\nFinal Scop:\n");
- DEBUG(dbgs() << S);
+ LLVM_DEBUG(dbgs() << "\nFinal Scop:\n");
+ LLVM_DEBUG(dbgs() << S);
// Update statistics
auto ScopStats = S.getStatistics();
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index 4f0c81edfde..cf26a1482da 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -1337,7 +1337,7 @@ ScheduleTreeOptimizer::optimizeBand(__isl_take isl_schedule_node *Node,
MatMulInfoTy MMI;
if (PMBasedOpts && User &&
isMatrMultPattern(isl::manage_copy(Node), OAI->D, MMI)) {
- DEBUG(dbgs() << "The matrix multiplication pattern was detected\n");
+ LLVM_DEBUG(dbgs() << "The matrix multiplication pattern was detected\n");
MatMulOpts++;
return optimizeMatMulPattern(isl::manage(Node), OAI->TTI, MMI).release();
}
@@ -1483,7 +1483,7 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
getAnalysis<DependenceInfo>().getDependences(Dependences::AL_Statement);
if (D.getSharedIslCtx() != S.getSharedIslCtx()) {
- DEBUG(dbgs() << "DependenceInfo for another SCoP/isl_ctx\n");
+ LLVM_DEBUG(dbgs() << "DependenceInfo for another SCoP/isl_ctx\n");
return false;
}
@@ -1538,10 +1538,10 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
"or 'no'. Falling back to default: 'yes'\n";
}
- DEBUG(dbgs() << "\n\nCompute schedule from: ");
- DEBUG(dbgs() << "Domain := " << Domain << ";\n");
- DEBUG(dbgs() << "Proximity := " << Proximity << ";\n");
- DEBUG(dbgs() << "Validity := " << Validity << ";\n");
+ LLVM_DEBUG(dbgs() << "\n\nCompute schedule from: ");
+ LLVM_DEBUG(dbgs() << "Domain := " << Domain << ";\n");
+ LLVM_DEBUG(dbgs() << "Proximity := " << Proximity << ";\n");
+ LLVM_DEBUG(dbgs() << "Validity := " << Validity << ";\n");
unsigned IslSerializeSCCs;
@@ -1607,7 +1607,7 @@ bool IslScheduleOptimizer::runOnScop(Scop &S) {
ScopsRescheduled++;
- DEBUG({
+ LLVM_DEBUG({
auto *P = isl_printer_to_str(Ctx);
P = isl_printer_set_yaml_style(P, ISL_YAML_STYLE_BLOCK);
P = isl_printer_print_schedule(P, Schedule.get());
diff --git a/polly/lib/Transform/ScopInliner.cpp b/polly/lib/Transform/ScopInliner.cpp
index a78c3e073a2..4aadb6a96f6 100644
--- a/polly/lib/Transform/ScopInliner.cpp
+++ b/polly/lib/Transform/ScopInliner.cpp
@@ -62,8 +62,8 @@ public:
if (!F)
return false;
if (F->isDeclaration()) {
- DEBUG(dbgs() << "Skipping " << F->getName()
- << "because it is a declaration.\n");
+ LLVM_DEBUG(dbgs() << "Skipping " << F->getName()
+ << "because it is a declaration.\n");
return false;
}
@@ -79,8 +79,8 @@ public:
SD.ValidRegions.count(RI.getTopLevelRegion()) > 0;
if (HasScopAsTopLevelRegion) {
- DEBUG(dbgs() << "Skipping " << F->getName()
- << " has scop as top level region");
+ LLVM_DEBUG(dbgs() << "Skipping " << F->getName()
+ << " has scop as top level region");
F->addFnAttr(llvm::Attribute::AlwaysInline);
ModuleAnalysisManager MAM;
@@ -91,8 +91,8 @@ public:
assert(M && "Function has illegal module");
MPM.run(*M, MAM);
} else {
- DEBUG(dbgs() << F->getName()
- << " does NOT have scop as top level region\n");
+ LLVM_DEBUG(dbgs() << F->getName()
+ << " does NOT have scop as top level region\n");
}
return false;
diff --git a/polly/lib/Transform/Simplify.cpp b/polly/lib/Transform/Simplify.cpp
index 73111d905e9..1402f434796 100644
--- a/polly/lib/Transform/Simplify.cpp
+++ b/polly/lib/Transform/Simplify.cpp
@@ -194,8 +194,8 @@ private:
// If all of a write's elements are overwritten, remove it.
isl::union_map AccRelUnion = AccRel;
if (AccRelUnion.is_subset(WillBeOverwritten)) {
- DEBUG(dbgs() << "Removing " << MA
- << " which will be overwritten anyway\n");
+ LLVM_DEBUG(dbgs() << "Removing " << MA
+ << " which will be overwritten anyway\n");
Stmt.removeSingleMemoryAccess(MA);
OverwritesRemoved++;
@@ -453,9 +453,9 @@ private:
isl::map AccRelStoredVal = isl::map::from_domain_and_range(
AccRelWrapped, makeValueSet(StoredVal));
if (isl::union_map(AccRelStoredVal).is_subset(Known)) {
- DEBUG(dbgs() << "Cleanup of " << MA << ":\n");
- DEBUG(dbgs() << " Scalar: " << *StoredVal << "\n");
- DEBUG(dbgs() << " AccRel: " << AccRel << "\n");
+ LLVM_DEBUG(dbgs() << "Cleanup of " << MA << ":\n");
+ LLVM_DEBUG(dbgs() << " Scalar: " << *StoredVal << "\n");
+ LLVM_DEBUG(dbgs() << " AccRel: " << AccRel << "\n");
Stmt.removeSingleMemoryAccess(MA);
@@ -497,8 +497,8 @@ private:
S->simplifySCoP(true);
assert(NumStmtsBefore >= S->getSize());
StmtsRemoved = NumStmtsBefore - S->getSize();
- DEBUG(dbgs() << "Removed " << StmtsRemoved << " (of " << NumStmtsBefore
- << ") statements\n");
+ LLVM_DEBUG(dbgs() << "Removed " << StmtsRemoved << " (of " << NumStmtsBefore
+ << ") statements\n");
TotalStmtsRemoved[CallNo] += StmtsRemoved;
}
@@ -516,8 +516,9 @@ private:
if (!AccRel.is_empty().is_true())
continue;
- DEBUG(dbgs() << "Removing " << MA
- << " because it's a partial access that never occurs\n");
+ LLVM_DEBUG(
+ dbgs() << "Removing " << MA
+ << " because it's a partial access that never occurs\n");
DeferredRemove.push_back(MA);
}
@@ -548,7 +549,8 @@ private:
for (MemoryAccess *MA : AllMAs) {
if (UsedMA.count(MA))
continue;
- DEBUG(dbgs() << "Removing " << MA << " because its value is not used\n");
+ LLVM_DEBUG(dbgs() << "Removing " << MA
+ << " because its value is not used\n");
ScopStmt *Stmt = MA->getStatement();
Stmt->removeSingleMemoryAccess(MA);
@@ -569,8 +571,8 @@ private:
for (Instruction *Inst : AllInsts) {
auto It = UsedInsts.find({&Stmt, Inst});
if (It == UsedInsts.end()) {
- DEBUG(dbgs() << "Removing "; Inst->print(dbgs());
- dbgs() << " because it is not used\n");
+ LLVM_DEBUG(dbgs() << "Removing "; Inst->print(dbgs());
+ dbgs() << " because it is not used\n");
DeadInstructionsRemoved++;
TotalDeadInstructionsRemoved[CallNo]++;
continue;
@@ -636,29 +638,29 @@ public:
this->S = &S;
ScopsProcessed[CallNo]++;
- DEBUG(dbgs() << "Removing partial writes that never happen...\n");
+ LLVM_DEBUG(dbgs() << "Removing partial writes that never happen...\n");
removeEmptyPartialAccesses();
- DEBUG(dbgs() << "Removing overwrites...\n");
+ LLVM_DEBUG(dbgs() << "Removing overwrites...\n");
removeOverwrites();
- DEBUG(dbgs() << "Coalesce partial writes...\n");
+ LLVM_DEBUG(dbgs() << "Coalesce partial writes...\n");
coalesceWrites();
- DEBUG(dbgs() << "Removing redundant writes...\n");
+ LLVM_DEBUG(dbgs() << "Removing redundant writes...\n");
removeRedundantWrites();
- DEBUG(dbgs() << "Cleanup unused accesses...\n");
+ LLVM_DEBUG(dbgs() << "Cleanup unused accesses...\n");
LoopInfo *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
markAndSweep(LI);
- DEBUG(dbgs() << "Removing statements without side effects...\n");
+ LLVM_DEBUG(dbgs() << "Removing statements without side effects...\n");
removeUnnecessaryStmts();
if (isModified())
ScopsModified[CallNo]++;
- DEBUG(dbgs() << "\nFinal Scop:\n");
- DEBUG(dbgs() << S);
+ LLVM_DEBUG(dbgs() << "\nFinal Scop:\n");
+ LLVM_DEBUG(dbgs() << S);
auto ScopStats = S.getStatistics();
NumValueWrites[CallNo] += ScopStats.NumValueWrites;
diff --git a/polly/lib/Transform/ZoneAlgo.cpp b/polly/lib/Transform/ZoneAlgo.cpp
index 3770953b1a5..2ad40d83d36 100644
--- a/polly/lib/Transform/ZoneAlgo.cpp
+++ b/polly/lib/Transform/ZoneAlgo.cpp
@@ -338,7 +338,8 @@ void ZoneAlgorithm::collectIncompatibleElts(ScopStmt *Stmt,
if (MA->isRead()) {
// Reject load after store to same location.
if (!Stores.is_disjoint(AccRel)) {
- DEBUG(dbgs() << "Load after store of same element in same statement\n");
+ LLVM_DEBUG(
+ dbgs() << "Load after store of same element in same statement\n");
OptimizationRemarkMissed R(PassName, "LoadAfterStore",
MA->getAccessInstruction());
R << "load after store of same element in same statement";
@@ -357,7 +358,7 @@ void ZoneAlgorithm::collectIncompatibleElts(ScopStmt *Stmt,
// In region statements the order is less clear, eg. the load and store
// might be in a boxed loop.
if (Stmt->isRegionStmt() && !Loads.is_disjoint(AccRel)) {
- DEBUG(dbgs() << "WRITE in non-affine subregion not supported\n");
+ LLVM_DEBUG(dbgs() << "WRITE in non-affine subregion not supported\n");
OptimizationRemarkMissed R(PassName, "StoreInSubregion",
MA->getAccessInstruction());
R << "store is in a non-affine subregion";
@@ -368,7 +369,7 @@ void ZoneAlgorithm::collectIncompatibleElts(ScopStmt *Stmt,
// Do not allow more than one store to the same location.
if (!Stores.is_disjoint(AccRel) && !onlySameValueWrites(Stmt)) {
- DEBUG(dbgs() << "WRITE after WRITE to same element\n");
+ LLVM_DEBUG(dbgs() << "WRITE after WRITE to same element\n");
OptimizationRemarkMissed R(PassName, "StoreAfterStore",
MA->getAccessInstruction());
R << "store after store of same element in same statement";
OpenPOWER on IntegriCloud