[polly] r311704 - [Polly] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 14:22:42 PDT 2017
Author: eugenezelenko
Date: Thu Aug 24 14:22:41 2017
New Revision: 311704
URL: http://llvm.org/viewvc/llvm-project?rev=311704&view=rev
Log:
[Polly] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
Modified:
polly/trunk/include/polly/CodeGen/CodeGeneration.h
polly/trunk/include/polly/CodeGen/IslAst.h
polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
polly/trunk/include/polly/ForwardOpTree.h
polly/trunk/include/polly/ScheduleOptimizer.h
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslAst.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/Transform/ForwardOpTree.cpp
polly/trunk/lib/Transform/ScheduleOptimizer.cpp
Modified: polly/trunk/include/polly/CodeGen/CodeGeneration.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/CodeGeneration.h?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/CodeGeneration.h (original)
+++ polly/trunk/include/polly/CodeGen/CodeGeneration.h Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ polly/CodeGeneration.h - The Polly code generator *- C++ -*-===//
+//===- polly/CodeGeneration.h - The Polly code generator --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -6,8 +6,6 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-//===----------------------------------------------------------------------===//
#ifndef POLLY_CODEGENERATION_H
#define POLLY_CODEGENERATION_H
@@ -15,10 +13,18 @@
#include "IRBuilder.h"
#include "polly/Config/config.h"
#include "polly/ScopPass.h"
-#include "isl/map.h"
-#include "isl/set.h"
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class BasicBlock;
+
+} // namespace llvm
namespace polly {
+
+class Scop;
+
enum VectorizerChoice {
VECTORIZER_NONE,
VECTORIZER_STRIPMINE,
@@ -38,6 +44,7 @@ struct CodeGenerationPass : public PassI
};
extern bool PerfMonitoring;
+
} // namespace polly
#endif // POLLY_CODEGENERATION_H
Modified: polly/trunk/include/polly/CodeGen/IslAst.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslAst.h?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslAst.h (original)
+++ polly/trunk/include/polly/CodeGen/IslAst.h Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===- IslAst.h - Interface to the isl code generator-------*- C++ -*-===//
+//===- IslAst.h - Interface to the isl code generator -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -19,37 +19,51 @@
//
//===----------------------------------------------------------------------===//
-#ifndef POLLY_ISL_AST_H
-#define POLLY_ISL_AST_H
+#ifndef POLLY_ISLAST_H
+#define POLLY_ISLAST_H
#include "polly/Config/config.h"
#include "polly/ScopPass.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/IR/PassManager.h"
#include "isl/ast.h"
+#include "isl/ctx.h"
+#include <memory>
namespace llvm {
+
+class PassRegistry;
class raw_ostream;
+
+void initializeIslAstInfoWrapperPassPass(PassRegistry &);
+
} // namespace llvm
-struct isl_pw_aff;
-struct isl_ast_node;
-struct isl_ast_expr;
struct isl_ast_build;
-struct isl_union_map;
+struct isl_ast_expr;
+struct isl_ast_node;
+struct isl_pw_aff;
struct isl_pw_multi_aff;
+struct isl_union_map;
namespace polly {
-class Scop;
-class IslAst;
-class MemoryAccess;
+
struct Dependences;
+class MemoryAccess;
+class Scop;
class IslAst {
public:
- static IslAst create(Scop &Scop, const Dependences &D);
+ IslAst(const IslAst &) = delete;
+ IslAst &operator=(const IslAst &) = delete;
+ IslAst(IslAst &&);
+ IslAst &operator=(IslAst &&) = delete;
~IslAst();
+ static IslAst create(Scop &Scop, const Dependences &D);
+
/// Print a source code representation of the program.
- void pprint(llvm::raw_ostream &OS);
+ void pprint(raw_ostream &OS);
__isl_give isl_ast_node *getAst();
@@ -65,18 +79,14 @@ public:
static isl_ast_expr *buildRunCondition(Scop &S,
__isl_keep isl_ast_build *Build);
- IslAst(const IslAst &) = delete;
- IslAst &operator=(const IslAst &) = delete;
- IslAst(IslAst &&);
- IslAst &operator=(IslAst &&) = delete;
-
private:
Scop &S;
- isl_ast_node *Root;
- isl_ast_expr *RunCondition;
+ isl_ast_node *Root = nullptr;
+ isl_ast_expr *RunCondition = nullptr;
std::shared_ptr<isl_ctx> Ctx;
IslAst(Scop &Scop);
+
void init(const Dependences &D);
};
@@ -87,31 +97,28 @@ public:
/// Payload information used to annotate an AST node.
struct IslAstUserPayload {
/// Construct and initialize the payload.
- IslAstUserPayload()
- : IsInnermost(false), IsInnermostParallel(false),
- IsOutermostParallel(false), IsReductionParallel(false),
- MinimalDependenceDistance(nullptr), Build(nullptr) {}
+ IslAstUserPayload() = default;
/// Cleanup all isl structs on destruction.
~IslAstUserPayload();
/// Flag to mark innermost loops.
- bool IsInnermost;
+ bool IsInnermost = false;
/// Flag to mark innermost parallel loops.
- bool IsInnermostParallel;
+ bool IsInnermostParallel = false;
/// Flag to mark outermost parallel loops.
- bool IsOutermostParallel;
+ bool IsOutermostParallel = false;
/// Flag to mark parallel loops which break reductions.
- bool IsReductionParallel;
+ bool IsReductionParallel = false;
/// The minimal dependence distance for non parallel loops.
- isl_pw_aff *MinimalDependenceDistance;
+ isl_pw_aff *MinimalDependenceDistance = nullptr;
/// The build environment at the time this node was constructed.
- isl_ast_build *Build;
+ isl_ast_build *Build = nullptr;
/// Set of accesses which break reduction dependences.
MemoryAccessSet BrokenReductions;
@@ -179,7 +186,9 @@ public:
struct IslAstAnalysis : public AnalysisInfoMixin<IslAstAnalysis> {
static AnalysisKey Key;
+
using Result = IslAstInfo;
+
IslAstInfo run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR);
};
@@ -189,6 +198,7 @@ class IslAstInfoWrapperPass : public Sco
public:
static char ID;
+
IslAstInfoWrapperPass() : ScopPass(ID) {}
IslAstInfo &getAI() { return *Ast; }
@@ -204,19 +214,18 @@ public:
void releaseMemory() override;
/// Print a source code representation of the program.
- void printScop(llvm::raw_ostream &OS, Scop &S) const override;
+ void printScop(raw_ostream &OS, Scop &S) const override;
};
struct IslAstPrinterPass : public PassInfoMixin<IslAstPrinterPass> {
- IslAstPrinterPass(raw_ostream &O) : Stream(O) {}
+ IslAstPrinterPass(raw_ostream &OS) : OS(OS) {}
+
PreservedAnalyses run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &, SPMUpdater &U);
- raw_ostream &Stream;
+
+ raw_ostream &OS;
};
+
} // namespace polly
-namespace llvm {
-class PassRegistry;
-void initializeIslAstInfoWrapperPassPass(llvm::PassRegistry &);
-} // namespace llvm
-#endif /* POLLY_ISL_AST_H */
+#endif // POLLY_ISLAST_H
Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ IslNodeBuilder.cpp - Translate an isl AST into a LLVM-IR AST---===//
+//=- IslNodeBuilder.cpp - Translate an isl AST into a LLVM-IR AST -*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
@@ -6,29 +6,57 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
// This file contains the IslNodeBuilder, a class to translate an isl AST into
// a LLVM-IR AST.
+//
//===----------------------------------------------------------------------===//
-#ifndef POLLY_ISL_NODE_BUILDER_H
-#define POLLY_ISL_NODE_BUILDER_H
+#ifndef POLLY_ISLNODEBUILDER_H
+#define POLLY_ISLNODEBUILDER_H
#include "polly/CodeGen/BlockGenerators.h"
#include "polly/CodeGen/IslExprBuilder.h"
-#include "polly/CodeGen/LoopGenerators.h"
-#include "polly/ScopInfo.h"
+#include "polly/ScopDetectionDiagnostic.h"
+#include "polly/Support/ScopHelper.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/IR/InstrTypes.h"
#include "isl/ctx.h"
#include "isl/isl-noexceptions.h"
-#include "isl/union_map.h"
#include <utility>
#include <vector>
-using namespace polly;
using namespace llvm;
+using namespace polly;
+
+namespace llvm {
+
+class BasicBlock;
+class DataLayout;
+class DominatorTree;
+class Function;
+class Instruction;
+class Loop;
+class LoopInfo;
+class ScalarEvolution;
+class SCEV;
+class Type;
+class Value;
+
+} // namespace llvm
+
+namespace polly {
+
+struct InvariantEquivClassTy;
+class MemoryAccess;
+class Scop;
+class ScopStmt;
+
+} // namespace polly
struct isl_ast_node;
struct isl_ast_build;
@@ -180,7 +208,7 @@ protected:
/// points to and the resulting value is returned.
///
/// @param Expr The expression to code generate.
- llvm::Value *generateSCEV(const SCEV *Expr);
+ Value *generateSCEV(const SCEV *Expr);
/// A set of Value -> Value remappings to apply when generating new code.
///
@@ -286,6 +314,7 @@ protected:
///
/// @param Mark The node we generate code for.
virtual void createMark(__isl_take isl_ast_node *Marker);
+
virtual void createFor(__isl_take isl_ast_node *For);
/// Set to remember materialized invariant loads.
@@ -432,4 +461,4 @@ private:
Value *materializeNonScopLoopInductionVariable(const Loop *L);
};
-#endif // POLLY_ISL_NODE_BUILDER_H
+#endif // POLLY_ISLNODEBUILDER_H
Modified: polly/trunk/include/polly/ForwardOpTree.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ForwardOpTree.h?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/include/polly/ForwardOpTree.h (original)
+++ polly/trunk/include/polly/ForwardOpTree.h Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ ForwardOpTree.h -------------------------------------*- C++ -*-===//
+//===- ForwardOpTree.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,15 +14,20 @@
#ifndef POLLY_FORWARDOPTREE_H
#define POLLY_FORWARDOPTREE_H
+namespace llvm {
+
+class PassRegistry;
+
+void initializeForwardOpTreePass(PassRegistry &);
+
+} // namespace llvm
+
namespace polly {
+
class ScopPass;
ScopPass *createForwardOpTreePass();
-} // namespace polly
-namespace llvm {
-class PassRegistry;
-void initializeForwardOpTreePass(llvm::PassRegistry &);
-} // namespace llvm
+} // namespace polly
-#endif /* POLLY_FORWARDOPTREE_H */
+#endif // POLLY_FORWARDOPTREE_H
Modified: polly/trunk/include/polly/ScheduleOptimizer.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScheduleOptimizer.h?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/include/polly/ScheduleOptimizer.h (original)
+++ polly/trunk/include/polly/ScheduleOptimizer.h Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ polly/ScheduleOptimizer.h - The Schedule Optimizer *- C++ -*-===//
+//===- polly/ScheduleOptimizer.h - The Schedule Optimizer -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -6,26 +6,25 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-//
-//===----------------------------------------------------------------------===//
-#ifndef POLLY_SCHEDULE_OPTIMIZER_H
-#define POLLY_SCHEDULE_OPTIMIZER_H
+#ifndef POLLY_SCHEDULEOPTIMIZER_H
+#define POLLY_SCHEDULEOPTIMIZER_H
-#include "polly/DependenceInfo.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include "isl/ctx.h"
+#include "isl/isl-noexceptions.h"
+
+namespace llvm {
+
+class TargetTransformInfo;
+
+} // namespace llvm
-struct isl_schedule;
struct isl_schedule_node;
-struct isl_union_map;
/// Parameters of the micro kernel.
///
/// Parameters, which determine sizes of rank-1 (i.e., outer product) update
/// used in the optimized matrix multiplication.
-///
struct MicroKernelParamsTy {
int Mr;
int Nr;
@@ -35,7 +34,6 @@ struct MicroKernelParamsTy {
///
/// Parameters, which determine sizes of blocks of partitioned matrices
/// used in the optimized matrix multiplication.
-///
struct MacroKernelParamsTy {
int Mc;
int Nc;
@@ -43,11 +41,15 @@ struct MacroKernelParamsTy {
};
namespace polly {
+
+struct Dependences;
+class MemoryAccess;
+class Scop;
+
/// Additional parameters of the schedule optimizer.
///
/// Target Transform Info and the SCoP dependencies used by the schedule
/// optimizer.
-///
struct OptimizerAdditionalInfoTy {
const llvm::TargetTransformInfo *TTI;
const Dependences *D;
@@ -57,7 +59,6 @@ struct OptimizerAdditionalInfoTy {
///
/// Parameters, which describe access relations that represent operands of the
/// matrix multiplication.
-///
struct MatMulInfoTy {
MemoryAccess *A = nullptr;
MemoryAccess *B = nullptr;
@@ -69,7 +70,7 @@ struct MatMulInfoTy {
};
extern bool DisablePollyTiling;
-class Scop;
+
} // namespace polly
class ScheduleTreeOptimizer {
@@ -353,4 +354,4 @@ private:
/// relation.
isl::set getPartialTilePrefixes(isl::set ScheduleRange, int VectorWidth);
-#endif
+#endif // POLLY_SCHEDULEOPTIMIZER_H
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ CodeGeneration.cpp - Code generate the Scops using ISL. ----======//
+//===- CodeGeneration.cpp - Code generate the Scops using ISL. ---------======//
//
// The LLVM Compiler Infrastructure
//
@@ -20,6 +20,7 @@
//===----------------------------------------------------------------------===//
#include "polly/CodeGen/CodeGeneration.h"
+#include "polly/CodeGen/IRBuilder.h"
#include "polly/CodeGen/IslAst.h"
#include "polly/CodeGen/IslNodeBuilder.h"
#include "polly/CodeGen/PerfMonitor.h"
@@ -27,20 +28,37 @@
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
+#include "polly/ScopDetectionDiagnostic.h"
#include "polly/ScopInfo.h"
#include "polly/Support/ScopHelper.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Dominators.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include "isl/ast.h"
+#include <cassert>
+#include <utility>
-using namespace polly;
using namespace llvm;
+using namespace polly;
#define DEBUG_TYPE "polly-codegen"
@@ -50,6 +68,7 @@ static cl::opt<bool> Verify("polly-codeg
cl::cat(PollyCategory));
bool polly::PerfMonitoring;
+
static cl::opt<bool, true>
XPerfMonitoring("polly-codegen-perf-monitoring",
cl::desc("Add run-time performance monitoring"), cl::Hidden,
@@ -64,6 +83,7 @@ STATISTIC(CodegenedBoxedLoops,
"Number of original boxed loops in SCoPs that have been generated");
namespace polly {
+
/// Mark a basic block unreachable.
///
/// Marks the basic block @p Block unreachable by equipping it with an
@@ -77,8 +97,6 @@ void markBlockUnreachable(BasicBlock &Bl
} // namespace polly
-namespace {
-
static void verifyGeneratedFunction(Scop &S, Function &F, IslAstInfo &AI) {
if (!Verify || !verifyFunction(F, &errs()))
return;
@@ -148,8 +166,8 @@ static void removeLifetimeMarkers(Region
if (auto *IT = dyn_cast<IntrinsicInst>(&*InstIt)) {
switch (IT->getIntrinsicID()) {
- case llvm::Intrinsic::lifetime_start:
- case llvm::Intrinsic::lifetime_end:
+ case Intrinsic::lifetime_start:
+ case Intrinsic::lifetime_end:
BB->getInstList().erase(InstIt);
break;
default:
@@ -223,7 +241,6 @@ static bool CodeGen(Scop &S, IslAstInfo
// If the hoisting fails we have to bail and execute the original code.
Builder.SetInsertPoint(SplitBlock->getTerminator());
if (!NodeBuilder.preloadInvariantLoads()) {
-
// Patch the introduced branch condition to ensure that we always execute
// the original SCoP.
auto *FalseI1 = Builder.getFalse();
@@ -278,12 +295,12 @@ static bool CodeGen(Scop &S, IslAstInfo
return true;
}
+namespace {
+
class CodeGeneration : public ScopPass {
public:
static char ID;
- CodeGeneration() : ScopPass(ID) {}
-
/// The data layout used.
const DataLayout *DL;
@@ -297,6 +314,8 @@ public:
RegionInfo *RI;
///}
+ CodeGeneration() : ScopPass(ID) {}
+
/// Generate LLVM-IR for the SCoP @p S.
bool runOnScop(Scop &S) override {
// Skip SCoPs in case they're already code-generated by PPCGCodeGeneration.
@@ -340,11 +359,12 @@ public:
AU.addPreserved<ScopInfoRegionPass>();
}
};
+
} // namespace
-PreservedAnalyses
-polly::CodeGenerationPass::run(Scop &S, ScopAnalysisManager &SAM,
- ScopStandardAnalysisResults &AR, SPMUpdater &U) {
+PreservedAnalyses CodeGenerationPass::run(Scop &S, ScopAnalysisManager &SAM,
+ ScopStandardAnalysisResults &AR,
+ SPMUpdater &U) {
auto &AI = SAM.getResult<IslAstAnalysis>(S, AR);
if (CodeGen(S, AI, AR.LI, AR.DT, AR.SE, AR.RI)) {
U.invalidateScop(S);
Modified: polly/trunk/lib/CodeGen/IslAst.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslAst.cpp?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslAst.cpp (original)
+++ polly/trunk/lib/CodeGen/IslAst.cpp Thu Aug 24 14:22:41 2017
@@ -32,17 +32,32 @@
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
+#include "polly/ScopDetection.h"
#include "polly/ScopInfo.h"
+#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
-#include "llvm/Analysis/RegionInfo.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/IR/Function.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/raw_ostream.h"
#include "isl/aff.h"
+#include "isl/ast.h"
#include "isl/ast_build.h"
-#include "isl/list.h"
+#include "isl/id.h"
+#include "isl/isl-noexceptions.h"
#include "isl/map.h"
+#include "isl/printer.h"
+#include "isl/schedule.h"
#include "isl/set.h"
#include "isl/union_map.h"
-
+#include "isl/val.h"
+#include <cassert>
+#include <cstdlib>
+#include <cstring>
+#include <map>
+#include <string>
#include <utility>
#define DEBUG_TYPE "polly-ast"
@@ -92,21 +107,22 @@ STATISTIC(NumExecutedInParallel, "Number
STATISTIC(NumIfConditions, "Number of if-conditions");
namespace polly {
+
/// Temporary information used when building the ast.
struct AstBuildUserInfo {
/// Construct and initialize the helper struct for AST creation.
- AstBuildUserInfo()
- : Deps(nullptr), InParallelFor(false), LastForNodeId(nullptr) {}
+ AstBuildUserInfo() = default;
/// The dependence information used for the parallelism check.
- const Dependences *Deps;
+ const Dependences *Deps = nullptr;
/// Flag to indicate that we are inside a parallel for node.
- bool InParallelFor;
+ bool InParallelFor = false;
/// The last iterator id created for the current SCoP.
- isl_id *LastForNodeId;
+ isl_id *LastForNodeId = nullptr;
};
+
} // namespace polly
/// Free an IslAstUserPayload object pointed to by @p Ptr.
@@ -162,7 +178,6 @@ static const std::string getBrokenReduct
static isl_printer *cbPrintFor(__isl_take isl_printer *Printer,
__isl_take isl_ast_print_options *Options,
__isl_keep isl_ast_node *Node, void *) {
-
isl_pw_aff *DD = IslAstInfo::getMinimalDependenceDistance(Node);
const std::string BrokenReductionsStr = getBrokenReductionsStr(Node);
const std::string KnownParallelStr = "#pragma known-parallel";
@@ -299,7 +314,7 @@ static isl_stat astBuildBeforeMark(__isl
return isl_stat_error;
AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
- if (!strcmp(isl_id_get_name(MarkId), "SIMD"))
+ if (strcmp(isl_id_get_name(MarkId), "SIMD") == 0)
BuildInfo->InParallelFor = true;
return isl_stat_ok;
@@ -311,7 +326,7 @@ astBuildAfterMark(__isl_take isl_ast_nod
assert(isl_ast_node_get_type(Node) == isl_ast_node_mark);
AstBuildUserInfo *BuildInfo = (AstBuildUserInfo *)User;
auto *Id = isl_ast_node_mark_get_id(Node);
- if (!strcmp(isl_id_get_name(Id), "SIMD"))
+ if (strcmp(isl_id_get_name(Id), "SIMD") == 0)
BuildInfo->InParallelFor = false;
isl_id_free(Id);
return Node;
@@ -401,7 +416,6 @@ IslAst::buildRunCondition(Scop &S, __isl
/// performed optimizations (e.g., tiling) or compute properties on the
/// original as well as optimized SCoP (e.g., #stride-one-accesses).
static bool benefitsFromPolly(Scop &Scop, bool PerformParallelTest) {
-
if (PollyProcessUnprofitable)
return true;
@@ -449,9 +463,18 @@ static void walkAstForStatistics(__isl_k
nullptr);
}
-IslAst::IslAst(Scop &Scop)
- : S(Scop), Root(nullptr), RunCondition(nullptr),
- Ctx(Scop.getSharedIslCtx()) {}
+IslAst::IslAst(Scop &Scop) : S(Scop), Ctx(Scop.getSharedIslCtx()) {}
+
+IslAst::IslAst(IslAst &&O)
+ : S(O.S), Root(O.Root), RunCondition(O.RunCondition), Ctx(O.Ctx) {
+ O.Root = nullptr;
+ O.RunCondition = nullptr;
+}
+
+IslAst::~IslAst() {
+ isl_ast_node_free(Root);
+ isl_ast_expr_free(RunCondition);
+}
void IslAst::init(const Dependences &D) {
bool PerformParallelTest = PollyParallel || DetectParallel ||
@@ -490,7 +513,7 @@ void IslAst::init(const Dependences &D)
if (PerformParallelTest) {
BuildInfo.Deps = &D;
- BuildInfo.InParallelFor = 0;
+ BuildInfo.InParallelFor = false;
Build = isl_ast_build_set_before_each_for(Build, &astBuildBeforeFor,
&BuildInfo);
@@ -518,17 +541,6 @@ IslAst IslAst::create(Scop &Scop, const
return Ast;
}
-IslAst::IslAst(IslAst &&O)
- : S(O.S), Root(O.Root), RunCondition(O.RunCondition), Ctx(O.Ctx) {
- O.Root = nullptr;
- O.RunCondition = nullptr;
-}
-
-IslAst::~IslAst() {
- isl_ast_node_free(Root);
- isl_ast_expr_free(RunCondition);
-}
-
__isl_give isl_ast_node *IslAst::getAst() { return isl_ast_node_copy(Root); }
__isl_give isl_ast_expr *IslAst::getRunCondition() {
return isl_ast_expr_copy(RunCondition);
@@ -574,7 +586,6 @@ bool IslAstInfo::isReductionParallel(__i
}
bool IslAstInfo::isExecutedInParallel(__isl_keep isl_ast_node *Node) {
-
if (!PollyParallel)
return false;
@@ -732,16 +743,14 @@ AnalysisKey IslAstAnalysis::Key;
PreservedAnalyses IslAstPrinterPass::run(Scop &S, ScopAnalysisManager &SAM,
ScopStandardAnalysisResults &SAR,
SPMUpdater &U) {
-
auto &Ast = SAM.getResult<IslAstAnalysis>(S, SAR);
- Ast.print(Stream);
+ Ast.print(OS);
return PreservedAnalyses::all();
}
void IslAstInfoWrapperPass::releaseMemory() { Ast.reset(); }
bool IslAstInfoWrapperPass::runOnScop(Scop &Scop) {
-
// Skip SCoPs in case they're already handled by PPCGCodeGeneration.
if (Scop.isToBeSkipped())
return false;
@@ -756,6 +765,7 @@ bool IslAstInfoWrapperPass::runOnScop(Sc
DEBUG(printScop(dbgs(), Scop));
return false;
}
+
void IslAstInfoWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const {
// Get the Common analysis usage of ScopPasses.
ScopPass::getAnalysisUsage(AU);
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ IslNodeBuilder.cpp - Translate an isl AST into a LLVM-IR AST---===//
+//===- IslNodeBuilder.cpp - Translate an isl AST into a LLVM-IR AST -------===//
//
// The LLVM Compiler Infrastructure
//
@@ -19,35 +19,57 @@
#include "polly/CodeGen/IslExprBuilder.h"
#include "polly/CodeGen/LoopGenerators.h"
#include "polly/CodeGen/RuntimeDebugBuilder.h"
-#include "polly/CodeGen/Utils.h"
#include "polly/Config/config.h"
-#include "polly/DependenceInfo.h"
-#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/SCEVValidator.h"
#include "polly/Support/ScopHelper.h"
+#include "llvm/ADT/APInt.h"
#include "llvm/ADT/PostOrderIterator.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/LoopInfo.h"
+#include "llvm/Analysis/RegionInfo.h"
+#include "llvm/Analysis/ScalarEvolution.h"
+#include "llvm/Analysis/ScalarEvolutionExpressions.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
+#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/Verifier.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Dominators.h"
+#include "llvm/IR/Function.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "isl/aff.h"
+#include "isl/aff_type.h"
#include "isl/ast.h"
#include "isl/ast_build.h"
-#include "isl/list.h"
+#include "isl/isl-noexceptions.h"
#include "isl/map.h"
#include "isl/set.h"
#include "isl/union_map.h"
#include "isl/union_set.h"
+#include "isl/val.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <cstring>
+#include <string>
+#include <utility>
+#include <vector>
-using namespace polly;
using namespace llvm;
+using namespace polly;
#define DEBUG_TYPE "polly-codegen"
@@ -138,7 +160,7 @@ static bool checkIslAstExprInt(__isl_tak
}
auto ExprVal = isl_ast_expr_get_val(Expr);
isl_ast_expr_free(Expr);
- if (Predicate(ExprVal) != true) {
+ if (Predicate(ExprVal) != isl_bool_true) {
isl_val_free(ExprVal);
return false;
}
@@ -305,7 +327,6 @@ IslNodeBuilder::getScheduleForAstNode(__
void IslNodeBuilder::getReferencesInSubtree(__isl_keep isl_ast_node *For,
SetVector<Value *> &Values,
SetVector<const Loop *> &Loops) {
-
SetVector<const SCEV *> SCEVs;
struct SubtreeReferences References = {
LI, SE, S, ValueMap, Values, SCEVs, getBlockGenerator(), nullptr};
@@ -408,7 +429,7 @@ void IslNodeBuilder::createMark(__isl_ta
isl_ast_node_free(Node);
// If a child node of a 'SIMD mark' is a loop that has a single iteration,
// it will be optimized away and we should skip it.
- if (!strcmp(isl_id_get_name(Id), "SIMD") &&
+ if (strcmp(isl_id_get_name(Id), "SIMD") == 0 &&
isl_ast_node_get_type(Child) == isl_ast_node_for) {
bool Vector = PollyVectorizerChoice == VECTORIZER_POLLY;
int VectorWidth = getNumberOfIterations(Child);
@@ -419,7 +440,7 @@ void IslNodeBuilder::createMark(__isl_ta
isl_id_free(Id);
return;
}
- if (!strcmp(isl_id_get_name(Id), "Inter iteration alias-free")) {
+ if (strcmp(isl_id_get_name(Id), "Inter iteration alias-free") == 0) {
auto *BasePtr = static_cast<Value *>(isl_id_get_user(Id));
Annotator.addInterIterationAliasFreeBasePtr(BasePtr);
}
@@ -489,7 +510,6 @@ void IslNodeBuilder::createForVector(__i
VectorLoops++;
}
-namespace {
/// Restore the initial ordering of dimensions of the band node
///
/// In case the band node represents all the dimensions of the iteration
@@ -498,17 +518,16 @@ namespace {
///
/// @param Node The band node to be modified.
/// @return The modified schedule node.
-bool IsLoopVectorizerDisabled(isl::ast_node Node) {
+static bool IsLoopVectorizerDisabled(isl::ast_node Node) {
assert(isl_ast_node_get_type(Node.keep()) == isl_ast_node_for);
auto Body = Node.for_get_body();
if (isl_ast_node_get_type(Body.keep()) != isl_ast_node_mark)
return false;
auto Id = Body.mark_get_id();
- if (!strcmp(Id.get_name().c_str(), "Loop Vectorizer Disabled"))
+ if (strcmp(Id.get_name().c_str(), "Loop Vectorizer Disabled") == 0)
return true;
return false;
}
-} // namespace
void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For,
bool KnownParallel) {
@@ -1042,7 +1061,6 @@ bool IslNodeBuilder::materializeValue(is
SetVector<Value *> Values;
findValues(ParamSCEV, SE, Values);
for (auto *Val : Values) {
-
// Check if the value is an instruction in a dead block within the SCoP
// and if so do not code generate it.
if (auto *Inst = dyn_cast<Instruction>(Val)) {
@@ -1073,7 +1091,6 @@ bool IslNodeBuilder::materializeValue(is
}
if (auto *IAClass = S.lookupInvariantEquivClass(Val)) {
-
// Check if this invariant access class is empty, hence if we never
// actually added a loads instruction to it. In that case it has no
// (meaningful) users and we should not try to code generate it.
@@ -1233,7 +1250,6 @@ Value *IslNodeBuilder::preloadUnconditio
Value *IslNodeBuilder::preloadInvariantLoad(const MemoryAccess &MA,
isl_set *Domain) {
-
isl_set *AccessRange = isl_map_range(MA.getAddressFunction().release());
AccessRange = isl_set_gist_params(AccessRange, S.getContext().release());
@@ -1431,7 +1447,6 @@ bool IslNodeBuilder::preloadInvariantEqu
}
for (const MemoryAccess *MA : MAs) {
-
Instruction *MAAccInst = MA->getAccessInstruction();
// Use the escape system to get the correct value to users outside the SCoP.
BlockGenerator::EscapeUserVectorTy EscapeUsers;
@@ -1498,7 +1513,6 @@ void IslNodeBuilder::allocateNewArrays(B
// Insert the free call at polly.exiting
CallInst::CreateFree(CreatedArray,
std::get<1>(StartExitBlocks)->getTerminator());
-
} else {
auto InstIt = Builder.GetInsertBlock()
->getParent()
@@ -1514,7 +1528,6 @@ void IslNodeBuilder::allocateNewArrays(B
}
bool IslNodeBuilder::preloadInvariantLoads() {
-
auto &InvariantEquivClasses = S.getInvariantAccesses();
if (InvariantEquivClasses.empty())
return true;
Modified: polly/trunk/lib/Transform/ForwardOpTree.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ForwardOpTree.cpp?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ForwardOpTree.cpp (original)
+++ polly/trunk/lib/Transform/ForwardOpTree.cpp Thu Aug 24 14:22:41 2017
@@ -1,4 +1,4 @@
-//===------ ForwardOpTree.h -------------------------------------*- C++ -*-===//
+//===- ForwardOpTree.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -12,9 +12,7 @@
//===----------------------------------------------------------------------===//
#include "polly/ForwardOpTree.h"
-
#include "polly/Options.h"
-#include "polly/RegisterPasses.h"
#include "polly/ScopBuilder.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
@@ -23,12 +21,30 @@
#include "polly/Support/ISLTools.h"
#include "polly/Support/VirtualInstruction.h"
#include "polly/ZoneAlgo.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
+#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/IR/Instruction.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Value.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include "isl/ctx.h"
+#include "isl/isl-noexceptions.h"
+#include <cassert>
+#include <memory>
#define DEBUG_TYPE "polly-optree"
-using namespace polly;
using namespace llvm;
+using namespace polly;
static cl::opt<bool>
AnalyzeKnown("polly-optree-analyze-known",
@@ -233,6 +249,9 @@ private:
}
public:
+ ForwardOpTreeImpl(Scop *S, LoopInfo *LI)
+ : ZoneAlgorithm("polly-optree", S, LI) {}
+
/// Compute the zones of known array element contents.
///
/// @return True if the computed #Known is usable.
@@ -287,7 +306,7 @@ public:
OS.indent(Indent) << "}\n";
}
- void printStatements(llvm::raw_ostream &OS, int Indent = 0) const {
+ void printStatements(raw_ostream &OS, int Indent = 0) const {
OS.indent(Indent) << "After statements {\n";
for (auto &Stmt : *S) {
OS.indent(Indent + 4) << Stmt.getBaseName() << "\n";
@@ -602,8 +621,8 @@ public:
///
/// @return If DoIt==false, return whether the operand tree can be forwarded.
/// If DoIt==true, return FD_DidForward.
- ForwardingDecision forwardTree(ScopStmt *TargetStmt, llvm::Value *UseVal,
- ScopStmt *UseStmt, llvm::Loop *UseLoop,
+ ForwardingDecision forwardTree(ScopStmt *TargetStmt, Value *UseVal,
+ ScopStmt *UseStmt, Loop *UseLoop,
isl::map UseToTarget, bool DoIt) {
ScopStmt *DefStmt = nullptr;
Loop *DefLoop = nullptr;
@@ -745,10 +764,6 @@ public:
return true;
}
-public:
- ForwardOpTreeImpl(Scop *S, LoopInfo *LI)
- : ZoneAlgorithm("polly-optree", S, LI) {}
-
/// Return which SCoP this instance is processing.
Scop *getScop() const { return S; }
@@ -796,7 +811,7 @@ public:
/// Print the pass result, performed transformations and the SCoP after the
/// transformation.
- void print(llvm::raw_ostream &OS, int Indent = 0) {
+ void print(raw_ostream &OS, int Indent = 0) {
printStatistics(OS, Indent);
if (!Modified) {
@@ -819,9 +834,6 @@ public:
/// there are less scalars to be mapped.
class ForwardOpTree : public ScopPass {
private:
- ForwardOpTree(const ForwardOpTree &) = delete;
- const ForwardOpTree &operator=(const ForwardOpTree &) = delete;
-
/// The pass implementation, also holding per-scop data.
std::unique_ptr<ForwardOpTreeImpl> Impl;
@@ -829,19 +841,21 @@ public:
static char ID;
explicit ForwardOpTree() : ScopPass(ID) {}
+ ForwardOpTree(const ForwardOpTree &) = delete;
+ ForwardOpTree &operator=(const ForwardOpTree &) = delete;
- virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequiredTransitive<ScopInfoRegionPass>();
AU.addRequired<LoopInfoWrapperPass>();
AU.setPreservesAll();
}
- virtual bool runOnScop(Scop &S) override {
+ bool runOnScop(Scop &S) override {
// Free resources for previous SCoP's computation, if not yet done.
releaseMemory();
LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
- Impl = make_unique<ForwardOpTreeImpl>(&S, &LI);
+ Impl = llvm::make_unique<ForwardOpTreeImpl>(&S, &LI);
if (AnalyzeKnown) {
DEBUG(dbgs() << "Prepare forwarders...\n");
@@ -866,7 +880,7 @@ public:
return false;
}
- virtual void printScop(raw_ostream &OS, Scop &S) const override {
+ void printScop(raw_ostream &OS, Scop &S) const override {
if (!Impl)
return;
@@ -874,12 +888,12 @@ public:
Impl->print(OS);
}
- virtual void releaseMemory() override { Impl.reset(); }
-
+ void releaseMemory() override { Impl.reset(); }
}; // class ForwardOpTree
char ForwardOpTree::ID;
-} // anonymous namespace
+
+} // namespace
ScopPass *polly::createForwardOpTreePass() { return new ForwardOpTree(); }
Modified: polly/trunk/lib/Transform/ScheduleOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ScheduleOptimizer.cpp?rev=311704&r1=311703&r2=311704&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ScheduleOptimizer.cpp (original)
+++ polly/trunk/lib/Transform/ScheduleOptimizer.cpp Thu Aug 24 14:22:41 2017
@@ -52,14 +52,19 @@
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
+#include "polly/ScopPass.h"
#include "polly/Simplify.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/IR/Function.h"
+#include "llvm/Pass.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "isl/aff.h"
-#include "isl/band.h"
+#include "llvm/Support/raw_ostream.h"
#include "isl/constraint.h"
+#include "isl/ctx.h"
#include "isl/map.h"
#include "isl/options.h"
#include "isl/printer.h"
@@ -68,6 +73,13 @@
#include "isl/space.h"
#include "isl/union_map.h"
#include "isl/union_set.h"
+#include <algorithm>
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <cstdlib>
+#include <string>
+#include <vector>
using namespace llvm;
using namespace polly;
@@ -245,7 +257,7 @@ STATISTIC(NumAffineLoopsOptimized, "Numb
STATISTIC(NumBoxedLoopsOptimized, "Number of boxed loops optimized");
#define THREE_STATISTICS(VARNAME, DESC) \
- static llvm::Statistic VARNAME[3] = { \
+ static Statistic VARNAME[3] = { \
{DEBUG_TYPE, #VARNAME "0", DESC " (original)", {0}, false}, \
{DEBUG_TYPE, #VARNAME "1", DESC " (after scheduler)", {0}, false}, \
{DEBUG_TYPE, #VARNAME "2", DESC " (after optimizer)", {0}, false}}
@@ -413,7 +425,7 @@ isl::schedule_node ScheduleTreeOptimizer
}
auto TileLoopMarkerStr = IdentifierString + " - Tiles";
auto TileLoopMarker =
- isl::id::alloc(Node.get_ctx(), TileLoopMarkerStr.c_str(), nullptr);
+ isl::id::alloc(Node.get_ctx(), TileLoopMarkerStr, nullptr);
Node = Node.insert_mark(TileLoopMarker);
Node = Node.child(0);
Node =
@@ -421,22 +433,19 @@ isl::schedule_node ScheduleTreeOptimizer
Node = Node.child(0);
auto PointLoopMarkerStr = IdentifierString + " - Points";
auto PointLoopMarker =
- isl::id::alloc(Node.get_ctx(), PointLoopMarkerStr.c_str(), nullptr);
+ isl::id::alloc(Node.get_ctx(), PointLoopMarkerStr, nullptr);
Node = Node.insert_mark(PointLoopMarker);
return Node.child(0);
}
-isl::schedule_node
-ScheduleTreeOptimizer::applyRegisterTiling(isl::schedule_node Node,
- llvm::ArrayRef<int> TileSizes,
- int DefaultTileSize) {
+isl::schedule_node ScheduleTreeOptimizer::applyRegisterTiling(
+ isl::schedule_node Node, ArrayRef<int> TileSizes, int DefaultTileSize) {
Node = tileNode(Node, "Register tiling", TileSizes, DefaultTileSize);
auto Ctx = Node.get_ctx();
return Node.band_set_ast_build_options(isl::union_set(Ctx, "{unroll[x]}"));
}
-namespace {
-bool isSimpleInnermostBand(const isl::schedule_node &Node) {
+static bool isSimpleInnermostBand(const isl::schedule_node &Node) {
assert(isl_schedule_node_get_type(Node.keep()) == isl_schedule_node_band);
assert(isl_schedule_node_n_children(Node.keep()) == 1);
@@ -461,7 +470,6 @@ bool isSimpleInnermostBand(const isl::sc
}
return true;
}
-} // namespace
bool ScheduleTreeOptimizer::isTileableBandNode(isl::schedule_node Node) {
if (isl_schedule_node_get_type(Node.get()) != isl_schedule_node_band)
@@ -566,7 +574,6 @@ isl::map permuteDimensions(isl::map Map,
/// otherwise.
static bool isMatMulOperandAcc(isl::set Domain, isl::map AccMap, int &FirstPos,
int &SecondPos) {
-
isl::space Space = AccMap.get_space();
isl::map Universe = isl::map::universe(Space);
@@ -865,7 +872,7 @@ static uint64_t getMatMulTypeSize(MatMul
/// @return The structure of type MicroKernelParamsTy.
/// @see MicroKernelParamsTy
static struct MicroKernelParamsTy
-getMicroKernelParams(const llvm::TargetTransformInfo *TTI, MatMulInfoTy MMI) {
+getMicroKernelParams(const TargetTransformInfo *TTI, MatMulInfoTy MMI) {
assert(TTI && "The target transform info should be provided.");
// Nvec - Number of double-precision floating-point numbers that can be hold
@@ -1154,7 +1161,7 @@ isolateAndUnrollMatMulInnerLoops(isl::sc
/// @param BasePtr The pointer to be marked.
/// @return The modified isl_schedule_node.
static isl::schedule_node markInterIterationAliasFree(isl::schedule_node Node,
- llvm::Value *BasePtr) {
+ Value *BasePtr) {
if (!BasePtr)
return Node;
@@ -1180,8 +1187,8 @@ static isl::schedule_node markLoopVector
///
/// @param Node The band node to be modified.
/// @return The modified schedule node.
-namespace {
-isl::schedule_node getBandNodeWithOriginDimOrder(isl::schedule_node Node) {
+static isl::schedule_node
+getBandNodeWithOriginDimOrder(isl::schedule_node Node) {
assert(isl_schedule_node_get_type(Node.keep()) == isl_schedule_node_band);
if (isl_schedule_node_get_type(Node.child(0).keep()) !=
isl_schedule_node_leaf)
@@ -1200,11 +1207,11 @@ isl::schedule_node getBandNodeWithOrigin
PartialScheduleMultiPwAff.reset_tuple_id(isl::dim::set);
return Node.insert_partial_schedule(PartialScheduleMultiPwAff);
}
-} // namespace
-isl::schedule_node ScheduleTreeOptimizer::optimizeMatMulPattern(
- isl::schedule_node Node, const llvm::TargetTransformInfo *TTI,
- MatMulInfoTy &MMI) {
+isl::schedule_node
+ScheduleTreeOptimizer::optimizeMatMulPattern(isl::schedule_node Node,
+ const TargetTransformInfo *TTI,
+ MatMulInfoTy &MMI) {
assert(TTI && "The target transform info should be provided.");
Node = markInterIterationAliasFree(
Node, MMI.WriteToC->getLatestScopArrayInfo()->getBasePtr());
@@ -1314,12 +1321,14 @@ bool ScheduleTreeOptimizer::isProfitable
}
namespace {
+
class IslScheduleOptimizer : public ScopPass {
public:
static char ID;
- explicit IslScheduleOptimizer() : ScopPass(ID) { LastSchedule = nullptr; }
- ~IslScheduleOptimizer() { isl_schedule_free(LastSchedule); }
+ explicit IslScheduleOptimizer() : ScopPass(ID) {}
+
+ ~IslScheduleOptimizer() override { isl_schedule_free(LastSchedule); }
/// Optimize the schedule of the SCoP @p S.
bool runOnScop(Scop &S) override;
@@ -1337,8 +1346,9 @@ public:
}
private:
- isl_schedule *LastSchedule;
+ isl_schedule *LastSchedule = nullptr;
};
+
} // namespace
char IslScheduleOptimizer::ID = 0;
@@ -1371,7 +1381,8 @@ static void walkScheduleTreeForStatistic
if (Node.band_member_get_coincident(i))
NumCoincident[Version]++;
}
- } break;
+ break;
+ }
case isl_schedule_node_filter:
NumFilters[Version]++;
@@ -1390,7 +1401,6 @@ static void walkScheduleTreeForStatistic
}
bool IslScheduleOptimizer::runOnScop(Scop &S) {
-
// Skip SCoPs in case they're already optimised by PPCGCodeGeneration
if (S.isToBeSkipped())
return false;
More information about the llvm-commits
mailing list