mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
[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
This commit is contained in:
parent
e7245b429b
commit
349506a926
@ -296,9 +296,10 @@ static __isl_give isl_union_flow *buildFlow(__isl_keep isl_union_map *Snk,
|
||||
AI = isl_union_access_info_set_must_source(AI, isl_union_map_copy(Src));
|
||||
AI = isl_union_access_info_set_schedule(AI, isl_schedule_copy(Schedule));
|
||||
auto Flow = isl_union_access_info_compute_flow(AI);
|
||||
DEBUG(if (!Flow) dbgs() << "last error: "
|
||||
<< isl_ctx_last_error(isl_schedule_get_ctx(Schedule))
|
||||
<< '\n';);
|
||||
LLVM_DEBUG(if (!Flow) dbgs()
|
||||
<< "last error: "
|
||||
<< isl_ctx_last_error(isl_schedule_get_ctx(Schedule))
|
||||
<< '\n';);
|
||||
return Flow;
|
||||
}
|
||||
|
||||
@ -407,18 +408,18 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
isl_schedule *Schedule;
|
||||
isl_union_set *TaggedStmtDomain;
|
||||
|
||||
DEBUG(dbgs() << "Scop: \n" << S << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Scop: \n" << S << "\n");
|
||||
|
||||
collectInfo(S, Read, MustWrite, MayWrite, ReductionTagMap, TaggedStmtDomain,
|
||||
Level);
|
||||
|
||||
bool HasReductions = !isl_union_map_is_empty(ReductionTagMap);
|
||||
|
||||
DEBUG(dbgs() << "Read: " << Read << '\n';
|
||||
dbgs() << "MustWrite: " << MustWrite << '\n';
|
||||
dbgs() << "MayWrite: " << MayWrite << '\n';
|
||||
dbgs() << "ReductionTagMap: " << ReductionTagMap << '\n';
|
||||
dbgs() << "TaggedStmtDomain: " << TaggedStmtDomain << '\n';);
|
||||
LLVM_DEBUG(dbgs() << "Read: " << Read << '\n';
|
||||
dbgs() << "MustWrite: " << MustWrite << '\n';
|
||||
dbgs() << "MayWrite: " << MayWrite << '\n';
|
||||
dbgs() << "ReductionTagMap: " << ReductionTagMap << '\n';
|
||||
dbgs() << "TaggedStmtDomain: " << TaggedStmtDomain << '\n';);
|
||||
|
||||
Schedule = S.getScheduleTree().release();
|
||||
|
||||
@ -455,10 +456,10 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
Schedule = isl_schedule_pullback_union_pw_multi_aff(Schedule, Tags);
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "Read: " << Read << "\n";
|
||||
dbgs() << "MustWrite: " << MustWrite << "\n";
|
||||
dbgs() << "MayWrite: " << MayWrite << "\n";
|
||||
dbgs() << "Schedule: " << Schedule << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Read: " << Read << "\n";
|
||||
dbgs() << "MustWrite: " << MustWrite << "\n";
|
||||
dbgs() << "MayWrite: " << MayWrite << "\n";
|
||||
dbgs() << "Schedule: " << Schedule << "\n");
|
||||
|
||||
isl_union_map *StrictWAW = nullptr;
|
||||
{
|
||||
@ -600,7 +601,7 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
isl_union_map_copy(WAW), isl_union_set_copy(TaggedStmtDomain));
|
||||
STMT_WAR =
|
||||
isl_union_map_intersect_domain(isl_union_map_copy(WAR), TaggedStmtDomain);
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "Wrapped Dependences:\n";
|
||||
dump();
|
||||
dbgs() << "\n";
|
||||
@ -649,7 +650,7 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
} else
|
||||
TC_RED = isl_union_map_empty(isl_union_map_get_space(RED));
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "Final Wrapped Dependences:\n";
|
||||
dump();
|
||||
dbgs() << "\n";
|
||||
@ -699,7 +700,7 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
RED = isl_union_map_zip(RED);
|
||||
TC_RED = isl_union_map_zip(TC_RED);
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "Zipped Dependences:\n";
|
||||
dump();
|
||||
dbgs() << "\n";
|
||||
@ -711,7 +712,7 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
RED = isl_union_set_unwrap(isl_union_map_domain(RED));
|
||||
TC_RED = isl_union_set_unwrap(isl_union_map_domain(TC_RED));
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "Unwrapped Dependences:\n";
|
||||
dump();
|
||||
dbgs() << "\n";
|
||||
@ -727,7 +728,7 @@ void Dependences::calculateDependences(Scop &S) {
|
||||
RED = isl_union_map_coalesce(RED);
|
||||
TC_RED = isl_union_map_coalesce(TC_RED);
|
||||
|
||||
DEBUG(dump());
|
||||
LLVM_DEBUG(dump());
|
||||
}
|
||||
|
||||
bool Dependences::isValidSchedule(Scop &S,
|
||||
|
@ -79,15 +79,15 @@ bool PolyhedralInfo::checkParallel(Loop *L, isl_pw_aff **MinDepDistPtr) const {
|
||||
DI->getDependences(const_cast<Scop *>(S), Dependences::AL_Access);
|
||||
if (!D.hasValidDependences())
|
||||
return false;
|
||||
DEBUG(dbgs() << "Loop :\t" << L->getHeader()->getName() << ":\n");
|
||||
LLVM_DEBUG(dbgs() << "Loop :\t" << L->getHeader()->getName() << ":\n");
|
||||
|
||||
isl_union_map *Deps =
|
||||
D.getDependences(Dependences::TYPE_RAW | Dependences::TYPE_WAW |
|
||||
Dependences::TYPE_WAR | Dependences::TYPE_RED);
|
||||
DEBUG(dbgs() << "Dependences :\t" << stringFromIslObj(Deps) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Dependences :\t" << stringFromIslObj(Deps) << "\n");
|
||||
|
||||
isl_union_map *Schedule = getScheduleForLoop(S, L);
|
||||
DEBUG(dbgs() << "Schedule: \t" << stringFromIslObj(Schedule) << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Schedule: \t" << stringFromIslObj(Schedule) << "\n");
|
||||
|
||||
IsParallel = D.isParallel(Schedule, Deps, MinDepDistPtr);
|
||||
isl_union_map_free(Schedule);
|
||||
@ -123,14 +123,14 @@ __isl_give isl_union_map *PolyhedralInfo::getScheduleForLoop(const Scop *S,
|
||||
Loop *L) const {
|
||||
isl_union_map *Schedule = isl_union_map_empty(S->getParamSpace().release());
|
||||
int CurrDim = S->getRelativeLoopDepth(L);
|
||||
DEBUG(dbgs() << "Relative loop depth:\t" << CurrDim << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Relative loop depth:\t" << CurrDim << "\n");
|
||||
assert(CurrDim >= 0 && "Loop in region should have at least depth one");
|
||||
|
||||
for (auto &SS : *S) {
|
||||
if (L->contains(SS.getSurroundingLoop())) {
|
||||
|
||||
unsigned int MaxDim = SS.getNumIterators();
|
||||
DEBUG(dbgs() << "Maximum depth of Stmt:\t" << MaxDim << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Maximum depth of Stmt:\t" << MaxDim << "\n");
|
||||
isl_map *ScheduleMap = SS.getSchedule().release();
|
||||
assert(
|
||||
ScheduleMap &&
|
||||
|
@ -73,16 +73,18 @@ public:
|
||||
|
||||
bool runOnScop(Scop &S) override {
|
||||
if (PollyProcessUnprofitable) {
|
||||
DEBUG(dbgs() << "NOTE: -polly-process-unprofitable active, won't prune "
|
||||
"anything\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "NOTE: -polly-process-unprofitable active, won't prune "
|
||||
"anything\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ScopsProcessed++;
|
||||
|
||||
if (!S.isProfitable(true)) {
|
||||
DEBUG(dbgs() << "SCoP pruned because it probably cannot be optimized in "
|
||||
"a significant way\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "SCoP pruned because it probably cannot be optimized in "
|
||||
"a significant way\n");
|
||||
S.invalidate(PROFITABLE, DebugLoc());
|
||||
updateStatistics(S, true);
|
||||
} else {
|
||||
|
@ -1511,7 +1511,8 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
DenseMap<BasicBlock *, isl::set> InvalidDomainMap;
|
||||
|
||||
if (!scop->buildDomains(&R, DT, LI, InvalidDomainMap)) {
|
||||
DEBUG(dbgs() << "Bailing-out because buildDomains encountered problems\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "Bailing-out because buildDomains encountered problems\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1530,7 +1531,7 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
scop->removeStmtNotInDomainMap();
|
||||
scop->simplifySCoP(false);
|
||||
if (scop->isEmpty()) {
|
||||
DEBUG(dbgs() << "Bailing-out because SCoP is empty\n");
|
||||
LLVM_DEBUG(dbgs() << "Bailing-out because SCoP is empty\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1546,7 +1547,7 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
|
||||
// Check early for a feasible runtime context.
|
||||
if (!scop->hasFeasibleRuntimeContext()) {
|
||||
DEBUG(dbgs() << "Bailing-out because of unfeasible context (early)\n");
|
||||
LLVM_DEBUG(dbgs() << "Bailing-out because of unfeasible context (early)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1554,7 +1555,8 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
// only the runtime context could become infeasible.
|
||||
if (!scop->isProfitable(UnprofitableScalarAccs)) {
|
||||
scop->invalidate(PROFITABLE, DebugLoc());
|
||||
DEBUG(dbgs() << "Bailing-out because SCoP is not considered profitable\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "Bailing-out because SCoP is not considered profitable\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1572,7 +1574,7 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
|
||||
scop->simplifyContexts();
|
||||
if (!scop->buildAliasChecks(AA)) {
|
||||
DEBUG(dbgs() << "Bailing-out because could not build alias checks\n");
|
||||
LLVM_DEBUG(dbgs() << "Bailing-out because could not build alias checks\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1584,7 +1586,7 @@ void ScopBuilder::buildScop(Region &R, AssumptionCache &AC,
|
||||
// Check late for a feasible runtime context because profitability did not
|
||||
// change.
|
||||
if (!scop->hasFeasibleRuntimeContext()) {
|
||||
DEBUG(dbgs() << "Bailing-out because of unfeasible context (late)\n");
|
||||
LLVM_DEBUG(dbgs() << "Bailing-out because of unfeasible context (late)\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1608,12 +1610,12 @@ ScopBuilder::ScopBuilder(Region *R, AssumptionCache &AC, AliasAnalysis &AA,
|
||||
|
||||
buildScop(*R, AC, ORE);
|
||||
|
||||
DEBUG(dbgs() << *scop);
|
||||
LLVM_DEBUG(dbgs() << *scop);
|
||||
|
||||
if (!scop->hasFeasibleRuntimeContext()) {
|
||||
InfeasibleScops++;
|
||||
Msg = "SCoP ends here but was dismissed.";
|
||||
DEBUG(dbgs() << "SCoP detected but dismissed\n");
|
||||
LLVM_DEBUG(dbgs() << "SCoP detected but dismissed\n");
|
||||
scop.reset();
|
||||
} else {
|
||||
Msg = "SCoP ends here.";
|
||||
|
@ -410,8 +410,8 @@ inline bool ScopDetection::invalid(DetectionContext &Context, bool Assert,
|
||||
if (PollyTrackFailures)
|
||||
Log.report(RejectReason);
|
||||
|
||||
DEBUG(dbgs() << RejectReason->getMessage());
|
||||
DEBUG(dbgs() << "\n");
|
||||
LLVM_DEBUG(dbgs() << RejectReason->getMessage());
|
||||
LLVM_DEBUG(dbgs() << "\n");
|
||||
} else {
|
||||
assert(!Assert && "Verification of detected scop failed");
|
||||
}
|
||||
@ -704,8 +704,8 @@ bool ScopDetection::isValidCallInst(CallInst &CI,
|
||||
return false;
|
||||
|
||||
if (isDebugCall(&CI)) {
|
||||
DEBUG(dbgs() << "Allow call to debug function: "
|
||||
<< CalledFunction->getName() << '\n');
|
||||
LLVM_DEBUG(dbgs() << "Allow call to debug function: "
|
||||
<< CalledFunction->getName() << '\n');
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1383,14 +1383,14 @@ Region *ScopDetection::expandRegion(Region &R) {
|
||||
std::unique_ptr<Region> LastValidRegion;
|
||||
auto ExpandedRegion = std::unique_ptr<Region>(R.getExpandedRegion());
|
||||
|
||||
DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "\tExpanding " << R.getNameStr() << "\n");
|
||||
|
||||
while (ExpandedRegion) {
|
||||
const auto &It = DetectionContextMap.insert(std::make_pair(
|
||||
getBBPairForRegion(ExpandedRegion.get()),
|
||||
DetectionContext(*ExpandedRegion, AA, false /*verifying*/)));
|
||||
DetectionContext &Context = It.first->second;
|
||||
DEBUG(dbgs() << "\t\tTrying " << ExpandedRegion->getNameStr() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "\t\tTrying " << ExpandedRegion->getNameStr() << "\n");
|
||||
// Only expand when we did not collect errors.
|
||||
|
||||
if (!Context.Log.hasErrors()) {
|
||||
@ -1424,7 +1424,7 @@ Region *ScopDetection::expandRegion(Region &R) {
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
if (LastValidRegion)
|
||||
dbgs() << "\tto " << LastValidRegion->getNameStr() << "\n";
|
||||
else
|
||||
@ -1630,23 +1630,23 @@ bool ScopDetection::isProfitableRegion(DetectionContext &Context) const {
|
||||
bool ScopDetection::isValidRegion(DetectionContext &Context) const {
|
||||
Region &CurRegion = Context.CurRegion;
|
||||
|
||||
DEBUG(dbgs() << "Checking region: " << CurRegion.getNameStr() << "\n\t");
|
||||
LLVM_DEBUG(dbgs() << "Checking region: " << CurRegion.getNameStr() << "\n\t");
|
||||
|
||||
if (!PollyAllowFullFunction && CurRegion.isTopLevelRegion()) {
|
||||
DEBUG(dbgs() << "Top level region is invalid\n");
|
||||
LLVM_DEBUG(dbgs() << "Top level region is invalid\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugLoc DbgLoc;
|
||||
if (CurRegion.getExit() &&
|
||||
isa<UnreachableInst>(CurRegion.getExit()->getTerminator())) {
|
||||
DEBUG(dbgs() << "Unreachable in exit\n");
|
||||
LLVM_DEBUG(dbgs() << "Unreachable in exit\n");
|
||||
return invalid<ReportUnreachableInExit>(Context, /*Assert=*/true,
|
||||
CurRegion.getExit(), DbgLoc);
|
||||
}
|
||||
|
||||
if (!CurRegion.getEntry()->getName().count(OnlyRegion)) {
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "Region entry does not match -polly-region-only";
|
||||
dbgs() << "\n";
|
||||
});
|
||||
@ -1667,7 +1667,7 @@ bool ScopDetection::isValidRegion(DetectionContext &Context) const {
|
||||
return invalid<ReportIrreducibleRegion>(Context, /*Assert=*/true,
|
||||
&CurRegion, DbgLoc);
|
||||
|
||||
DEBUG(dbgs() << "OK\n");
|
||||
LLVM_DEBUG(dbgs() << "OK\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3101,12 +3101,13 @@ bool Scop::buildAliasChecks(AliasAnalysis &AA) {
|
||||
// we make the assumed context infeasible.
|
||||
invalidate(ALIASING, DebugLoc());
|
||||
|
||||
DEBUG(dbgs() << "\n\nNOTE: Run time checks for " << getNameStr()
|
||||
<< " could not be created as the number of parameters involved "
|
||||
"is too high. The SCoP will be "
|
||||
"dismissed.\nUse:\n\t--polly-rtc-max-parameters=X\nto adjust "
|
||||
"the maximal number of parameters but be advised that the "
|
||||
"compile time might increase exponentially.\n\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "\n\nNOTE: Run time checks for " << getNameStr()
|
||||
<< " could not be created as the number of parameters involved "
|
||||
"is too high. The SCoP will be "
|
||||
"dismissed.\nUse:\n\t--polly-rtc-max-parameters=X\nto adjust "
|
||||
"the maximal number of parameters but be advised that the "
|
||||
"compile time might increase exponentially.\n\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4313,7 +4314,7 @@ void Scop::addRecordedAssumptions() {
|
||||
}
|
||||
|
||||
void Scop::invalidate(AssumptionKind Kind, DebugLoc Loc, BasicBlock *BB) {
|
||||
DEBUG(dbgs() << "Invalidate SCoP because of reason " << Kind << "\n");
|
||||
LLVM_DEBUG(dbgs() << "Invalidate SCoP because of reason " << Kind << "\n");
|
||||
addAssumption(Kind, isl::set::empty(getParamSpace()), Loc, AS_ASSUMPTION, BB);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ static void verifyGeneratedFunction(Scop &S, Function &F, IslAstInfo &AI) {
|
||||
if (!Verify || !verifyFunction(F, &errs()))
|
||||
return;
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
errs() << "== ISL Codegen created an invalid function ==\n\n== The "
|
||||
"SCoP ==\n";
|
||||
errs() << S;
|
||||
@ -196,7 +196,7 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
|
||||
// DependenceInfo or IslAstInfo around.
|
||||
IslAst &Ast = AI.getIslAst();
|
||||
if (Ast.getSharedIslCtx() != S.getSharedIslCtx()) {
|
||||
DEBUG(dbgs() << "Got an IstAst for a different Scop/isl_ctx\n");
|
||||
LLVM_DEBUG(dbgs() << "Got an IstAst for a different Scop/isl_ctx\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -119,12 +119,13 @@ public:
|
||||
|
||||
virtual bool runOnFunction(llvm::Function &F) override {
|
||||
if (!F.hasFnAttribute("polly-optimized")) {
|
||||
DEBUG(dbgs() << F.getName()
|
||||
<< ": Skipping cleanup because Polly did not optimize it.");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << F.getName()
|
||||
<< ": Skipping cleanup because Polly did not optimize it.");
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << F.getName() << ": Running codegen cleanup...");
|
||||
LLVM_DEBUG(dbgs() << F.getName() << ": Running codegen cleanup...");
|
||||
return FPM->run(F);
|
||||
}
|
||||
//@}
|
||||
|
@ -767,7 +767,7 @@ void IslAstInfo::print(raw_ostream &OS) {
|
||||
|
||||
auto *Schedule = S.getScheduleTree().release();
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << S.getContextStr() << "\n";
|
||||
dbgs() << stringFromIslObj(Schedule);
|
||||
});
|
||||
@ -807,14 +807,15 @@ bool IslAstInfoWrapperPass::runOnScop(Scop &Scop) {
|
||||
getAnalysis<DependenceInfo>().getDependences(Dependences::AL_Statement);
|
||||
|
||||
if (D.getSharedIslCtx() != Scop.getSharedIslCtx()) {
|
||||
DEBUG(dbgs() << "Got dependence analysis for different SCoP/isl_ctx\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "Got dependence analysis for different SCoP/isl_ctx\n");
|
||||
Ast.reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
Ast.reset(new IslAstInfo(Scop, D));
|
||||
|
||||
DEBUG(printScop(dbgs(), Scop));
|
||||
LLVM_DEBUG(printScop(dbgs(), Scop));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -124,8 +124,8 @@ static void expandConstantExpr(ConstantExpr *Cur, PollyIRBuilder &Builder,
|
||||
Instruction *I = Cur->getAsInstruction();
|
||||
assert(I && "unable to convert ConstantExpr to Instruction");
|
||||
|
||||
DEBUG(dbgs() << "Expanding ConstantExpression: (" << *Cur
|
||||
<< ") in Instruction: (" << *I << ")\n";);
|
||||
LLVM_DEBUG(dbgs() << "Expanding ConstantExpression: (" << *Cur
|
||||
<< ") in Instruction: (" << *I << ")\n";);
|
||||
|
||||
// Invalidate `Cur` so that no one after this point uses `Cur`. Rather,
|
||||
// they should mutate `I`.
|
||||
@ -209,19 +209,20 @@ replaceGlobalArray(Module &M, const DataLayout &DL, GlobalVariable &Array,
|
||||
Array.hasInternalLinkage() ||
|
||||
IgnoreLinkageForGlobals;
|
||||
if (!OnlyVisibleInsideModule) {
|
||||
DEBUG(dbgs() << "Not rewriting (" << Array
|
||||
<< ") to managed memory "
|
||||
"because it could be visible externally. To force rewrite, "
|
||||
"use -polly-acc-rewrite-ignore-linkage-for-globals.\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "Not rewriting (" << Array
|
||||
<< ") to managed memory "
|
||||
"because it could be visible externally. To force rewrite, "
|
||||
"use -polly-acc-rewrite-ignore-linkage-for-globals.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Array.hasInitializer() ||
|
||||
!isa<ConstantAggregateZero>(Array.getInitializer())) {
|
||||
DEBUG(dbgs() << "Not rewriting (" << Array
|
||||
<< ") to managed memory "
|
||||
"because it has an initializer which is "
|
||||
"not a zeroinitializer.\n");
|
||||
LLVM_DEBUG(dbgs() << "Not rewriting (" << Array
|
||||
<< ") to managed memory "
|
||||
"because it has an initializer which is "
|
||||
"not a zeroinitializer.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -288,14 +289,14 @@ static void getAllocasToBeManaged(Function &F,
|
||||
auto *Alloca = dyn_cast<AllocaInst>(&I);
|
||||
if (!Alloca)
|
||||
continue;
|
||||
DEBUG(dbgs() << "Checking if (" << *Alloca << ") may be captured: ");
|
||||
LLVM_DEBUG(dbgs() << "Checking if (" << *Alloca << ") may be captured: ");
|
||||
|
||||
if (PointerMayBeCaptured(Alloca, /* ReturnCaptures */ false,
|
||||
/* StoreCaptures */ true)) {
|
||||
Allocas.insert(Alloca);
|
||||
DEBUG(dbgs() << "YES (captured).\n");
|
||||
LLVM_DEBUG(dbgs() << "YES (captured).\n");
|
||||
} else {
|
||||
DEBUG(dbgs() << "NO (not captured).\n");
|
||||
LLVM_DEBUG(dbgs() << "NO (not captured).\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,7 +304,7 @@ static void getAllocasToBeManaged(Function &F,
|
||||
|
||||
static void rewriteAllocaAsManagedMemory(AllocaInst *Alloca,
|
||||
const DataLayout &DL) {
|
||||
DEBUG(dbgs() << "rewriting: (" << *Alloca << ") to managed mem.\n");
|
||||
LLVM_DEBUG(dbgs() << "rewriting: (" << *Alloca << ") to managed mem.\n");
|
||||
Module *M = Alloca->getModule();
|
||||
assert(M && "Alloca does not have a module");
|
||||
|
||||
|
@ -2205,7 +2205,7 @@ void GPUNodeBuilder::finalizeKernelArguments(ppcg_kernel *Kernel) {
|
||||
/// memory store or at least before each kernel barrier.
|
||||
if (Kernel->n_block != 0 || Kernel->n_grid != 0) {
|
||||
BuildSuccessful = 0;
|
||||
DEBUG(
|
||||
LLVM_DEBUG(
|
||||
dbgs() << getUniqueScopName(&S)
|
||||
<< " has a store to a scalar value that"
|
||||
" would be undefined to run in parallel. Bailing out.\n";);
|
||||
@ -2440,10 +2440,10 @@ void GPUNodeBuilder::addCUDALibDevice() {
|
||||
std::string GPUNodeBuilder::finalizeKernelFunction() {
|
||||
|
||||
if (verifyModule(*GPUModule)) {
|
||||
DEBUG(dbgs() << "verifyModule failed on module:\n";
|
||||
GPUModule->print(dbgs(), nullptr); dbgs() << "\n";);
|
||||
DEBUG(dbgs() << "verifyModule Error:\n";
|
||||
verifyModule(*GPUModule, &dbgs()););
|
||||
LLVM_DEBUG(dbgs() << "verifyModule failed on module:\n";
|
||||
GPUModule->print(dbgs(), nullptr); dbgs() << "\n";);
|
||||
LLVM_DEBUG(dbgs() << "verifyModule Error:\n";
|
||||
verifyModule(*GPUModule, &dbgs()););
|
||||
|
||||
if (FailOnVerifyModuleFailure)
|
||||
llvm_unreachable("VerifyModule failed.");
|
||||
@ -3230,8 +3230,8 @@ public:
|
||||
|
||||
if (!has_permutable || has_permutable < 0) {
|
||||
Schedule = isl_schedule_free(Schedule);
|
||||
DEBUG(dbgs() << getUniqueScopName(S)
|
||||
<< " does not have permutable bands. Bailing out\n";);
|
||||
LLVM_DEBUG(dbgs() << getUniqueScopName(S)
|
||||
<< " does not have permutable bands. Bailing out\n";);
|
||||
} else {
|
||||
const bool CreateTransferToFromDevice = !PollyManagedMemory;
|
||||
Schedule = map_to_device(PPCGGen, Schedule, CreateTransferToFromDevice);
|
||||
@ -3409,8 +3409,8 @@ public:
|
||||
// Look for (<func-type>*) among operands of Inst
|
||||
if (auto PtrTy = dyn_cast<PointerType>(Op->getType())) {
|
||||
if (isa<FunctionType>(PtrTy->getElementType())) {
|
||||
DEBUG(dbgs() << Inst
|
||||
<< " has illegal use of function in kernel.\n");
|
||||
LLVM_DEBUG(dbgs()
|
||||
<< Inst << " has illegal use of function in kernel.\n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -3488,9 +3488,9 @@ public:
|
||||
auto *SplitBBTerm = Builder.GetInsertBlock()->getTerminator();
|
||||
SplitBBTerm->setOperand(0, FalseI1);
|
||||
|
||||
DEBUG(dbgs() << "preloading invariant loads failed in function: " +
|
||||
S->getFunction().getName() +
|
||||
" | Scop Region: " + S->getNameStr());
|
||||
LLVM_DEBUG(dbgs() << "preloading invariant loads failed in function: " +
|
||||
S->getFunction().getName() +
|
||||
" | Scop Region: " + S->getNameStr());
|
||||
// adjust the dominator tree accordingly.
|
||||
auto *ExitingBlock = StartBlock->getUniqueSuccessor();
|
||||
assert(ExitingBlock);
|
||||
@ -3550,8 +3550,8 @@ public:
|
||||
DL = &S->getRegion().getEntry()->getModule()->getDataLayout();
|
||||
RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
|
||||
|
||||
DEBUG(dbgs() << "PPCGCodeGen running on : " << getUniqueScopName(S)
|
||||
<< " | loop depth: " << S->getMaxLoopDepth() << "\n");
|
||||
LLVM_DEBUG(dbgs() << "PPCGCodeGen running on : " << getUniqueScopName(S)
|
||||
<< " | loop depth: " << S->getMaxLoopDepth() << "\n");
|
||||
|
||||
// We currently do not support functions other than intrinsics inside
|
||||
// kernels, as code generation will need to offload function calls to the
|
||||
@ -3560,7 +3560,7 @@ public:
|
||||
// address of an intrinsic function to send to the kernel.
|
||||
if (containsInvalidKernelFunction(CurrentScop,
|
||||
Architecture == GPUArch::NVPTX64)) {
|
||||
DEBUG(
|
||||
LLVM_DEBUG(
|
||||
dbgs() << getUniqueScopName(S)
|
||||
<< " contains function which cannot be materialised in a GPU "
|
||||
"kernel. Bailing out.\n";);
|
||||
@ -3575,8 +3575,8 @@ public:
|
||||
generateCode(isl_ast_node_copy(PPCGGen->tree), PPCGProg);
|
||||
CurrentScop.markAsToBeSkipped();
|
||||
} else {
|
||||
DEBUG(dbgs() << getUniqueScopName(S)
|
||||
<< " has empty PPCGGen->tree. Bailing out.\n");
|
||||
LLVM_DEBUG(dbgs() << getUniqueScopName(S)
|
||||
<< " has empty PPCGGen->tree. Bailing out.\n");
|
||||
}
|
||||
|
||||
freeOptions(PPCGScop);
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
} else {
|
||||
Dumpfile = Filename;
|
||||
}
|
||||
DEBUG(dbgs() << "Dumping module to " << Dumpfile << '\n');
|
||||
LLVM_DEBUG(dbgs() << "Dumping module to " << Dumpfile << '\n');
|
||||
|
||||
std::unique_ptr<ToolOutputFile> Out;
|
||||
std::error_code EC;
|
||||
|
@ -205,11 +205,12 @@ public:
|
||||
}
|
||||
|
||||
if ((Op.isIV() || Op.isPARAM()) && !Return.isINT()) {
|
||||
DEBUG(dbgs() << "INVALID: More than one non-int operand in MulExpr\n"
|
||||
<< "\tExpr: " << *Expr << "\n"
|
||||
<< "\tPrevious expression type: " << Return << "\n"
|
||||
<< "\tNext operand (" << Op
|
||||
<< "): " << *Expr->getOperand(i) << "\n");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "INVALID: More than one non-int operand in MulExpr\n"
|
||||
<< "\tExpr: " << *Expr << "\n"
|
||||
<< "\tPrevious expression type: " << Return << "\n"
|
||||
<< "\tNext operand (" << Op << "): " << *Expr->getOperand(i)
|
||||
<< "\n");
|
||||
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
@ -225,7 +226,7 @@ public:
|
||||
|
||||
class ValidatorResult visitAddRecExpr(const SCEVAddRecExpr *Expr) {
|
||||
if (!Expr->isAffine()) {
|
||||
DEBUG(dbgs() << "INVALID: AddRec is not affine");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: AddRec is not affine");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -240,9 +241,10 @@ public:
|
||||
|
||||
auto *L = Expr->getLoop();
|
||||
if (R->contains(L) && (!Scope || !L->contains(Scope))) {
|
||||
DEBUG(dbgs() << "INVALID: Loop of AddRec expression boxed in an a "
|
||||
"non-affine subregion or has a non-synthesizable exit "
|
||||
"value.");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "INVALID: Loop of AddRec expression boxed in an a "
|
||||
"non-affine subregion or has a non-synthesizable exit "
|
||||
"value.");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -253,8 +255,8 @@ public:
|
||||
return Result;
|
||||
}
|
||||
|
||||
DEBUG(dbgs() << "INVALID: AddRec within scop has non-int"
|
||||
"recurrence part");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: AddRec within scop has non-int"
|
||||
"recurrence part");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -299,7 +301,7 @@ public:
|
||||
ValidatorResult Op = visit(Expr->getOperand(i));
|
||||
|
||||
if (!Op.isConstant()) {
|
||||
DEBUG(dbgs() << "INVALID: UMaxExpr has a non-constant operand");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: UMaxExpr has a non-constant operand");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
}
|
||||
@ -309,8 +311,8 @@ public:
|
||||
|
||||
ValidatorResult visitGenericInst(Instruction *I, const SCEV *S) {
|
||||
if (R->contains(I)) {
|
||||
DEBUG(dbgs() << "INVALID: UnknownExpr references an instruction "
|
||||
"within the region\n");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: UnknownExpr references an instruction "
|
||||
"within the region\n");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -358,7 +360,8 @@ public:
|
||||
if (LHS.isConstant() && RHS.isConstant())
|
||||
return ValidatorResult(SCEVType::PARAM, DivExpr);
|
||||
|
||||
DEBUG(dbgs() << "INVALID: unsigned division of non-constant expressions");
|
||||
LLVM_DEBUG(
|
||||
dbgs() << "INVALID: unsigned division of non-constant expressions");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -398,12 +401,12 @@ public:
|
||||
Value *V = Expr->getValue();
|
||||
|
||||
if (!Expr->getType()->isIntegerTy() && !Expr->getType()->isPointerTy()) {
|
||||
DEBUG(dbgs() << "INVALID: UnknownExpr is not an integer or pointer");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: UnknownExpr is not an integer or pointer");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
if (isa<UndefValue>(V)) {
|
||||
DEBUG(dbgs() << "INVALID: UnknownExpr references an undef value");
|
||||
LLVM_DEBUG(dbgs() << "INVALID: UnknownExpr references an undef value");
|
||||
return ValidatorResult(SCEVType::INVALID);
|
||||
}
|
||||
|
||||
@ -605,7 +608,7 @@ bool isAffineExpr(const Region *R, llvm::Loop *Scope, const SCEV *Expr,
|
||||
return false;
|
||||
|
||||
SCEVValidator Validator(R, Scope, SE, ILS);
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
dbgs() << "\n";
|
||||
dbgs() << "Expr: " << *Expr << "\n";
|
||||
dbgs() << "Region: " << R->getNameStr() << "\n";
|
||||
@ -614,7 +617,7 @@ bool isAffineExpr(const Region *R, llvm::Loop *Scope, const SCEV *Expr,
|
||||
|
||||
ValidatorResult Result = Validator.visit(Expr);
|
||||
|
||||
DEBUG({
|
||||
LLVM_DEBUG({
|
||||
if (Result.isValid())
|
||||
dbgs() << "VALID\n";
|
||||
dbgs() << "\n";
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user