[polly] r249919 - [NFC] Move helper functions to ScopHelper
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 16:40:24 PDT 2015
Author: jdoerfert
Date: Fri Oct 9 18:40:24 2015
New Revision: 249919
URL: http://llvm.org/viewvc/llvm-project?rev=249919&view=rev
Log:
[NFC] Move helper functions to ScopHelper
Helper functions in the BlockGenerators.h/cpp introduce dependences
from the frontend to the backend of Polly. As they are used in
ScopDetection, ScopInfo, etc. we move them to the ScopHelper file.
Modified:
polly/trunk/include/polly/CodeGen/BlockGenerators.h
polly/trunk/include/polly/Support/ScopHelper.h
polly/trunk/lib/Analysis/ScopDetection.cpp
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/lib/CodeGen/BlockGenerators.cpp
polly/trunk/lib/Support/ScopHelper.cpp
polly/trunk/lib/Transform/CodePreparation.cpp
polly/trunk/lib/Transform/IndependentBlocks.cpp
Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Fri Oct 9 18:40:24 2015
@@ -37,26 +37,6 @@ class ScopStmt;
class MemoryAccess;
class IslExprBuilder;
-/// @brief Check whether a value an be synthesized by the code generator.
-///
-/// Some value will be recalculated only from information that is code generated
-/// from the polyhedral representation. For such instructions we do not need to
-/// ensure that their operands are available during code generation.
-///
-/// @param V The value to check.
-/// @param LI The LoopInfo analysis.
-/// @param SE The scalar evolution database.
-/// @param R The region out of which SSA names are parameters.
-/// @return If the instruction I can be regenerated from its
-/// scalar evolution representation, return true,
-/// otherwise return false.
-bool canSynthesize(const llvm::Value *V, const llvm::LoopInfo *LI,
- llvm::ScalarEvolution *SE, const llvm::Region *R);
-
-/// @brief Return true iff @p V is an intrinsic that we ignore during code
-/// generation.
-bool isIgnoredIntrinsic(const llvm::Value *V);
-
/// @brief Generate a new basic block for a polyhedral statement.
class BlockGenerator {
public:
Modified: polly/trunk/include/polly/Support/ScopHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ScopHelper.h?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/ScopHelper.h (original)
+++ polly/trunk/include/polly/Support/ScopHelper.h Fri Oct 9 18:40:24 2015
@@ -155,5 +155,25 @@ llvm::Value *getConditionFromTerminator(
/// @return True if @p LInst can be hoisted in @p R.
bool isHoistableLoad(llvm::LoadInst *LInst, llvm::Region &R, llvm::LoopInfo &LI,
llvm::ScalarEvolution &SE);
+
+/// @brief Return true iff @p V is an intrinsic that we ignore during code
+/// generation.
+bool isIgnoredIntrinsic(const llvm::Value *V);
+
+/// @brief Check whether a value an be synthesized by the code generator.
+///
+/// Some value will be recalculated only from information that is code generated
+/// from the polyhedral representation. For such instructions we do not need to
+/// ensure that their operands are available during code generation.
+///
+/// @param V The value to check.
+/// @param LI The LoopInfo analysis.
+/// @param SE The scalar evolution database.
+/// @param R The region out of which SSA names are parameters.
+/// @return If the instruction I can be regenerated from its
+/// scalar evolution representation, return true,
+/// otherwise return false.
+bool canSynthesize(const llvm::Value *V, const llvm::LoopInfo *LI,
+ llvm::ScalarEvolution *SE, const llvm::Region *R);
}
#endif
Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Fri Oct 9 18:40:24 2015
@@ -44,7 +44,6 @@
//
//===----------------------------------------------------------------------===//
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/CodeGen/CodeGeneration.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Fri Oct 9 18:40:24 2015
@@ -18,7 +18,6 @@
//===----------------------------------------------------------------------===//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Fri Oct 9 18:40:24 2015
@@ -48,46 +48,6 @@ static cl::opt<bool> DebugPrinting(
cl::desc("Add printf calls that show the values loaded/stored."),
cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
-bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
- ScalarEvolution *SE, const Region *R) {
- if (!V || !SE->isSCEVable(V->getType()))
- return false;
-
- if (const SCEV *Scev = SE->getSCEV(const_cast<Value *>(V)))
- if (!isa<SCEVCouldNotCompute>(Scev))
- if (!hasScalarDepsInsideRegion(Scev, R))
- return true;
-
- return false;
-}
-
-bool polly::isIgnoredIntrinsic(const Value *V) {
- if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
- switch (IT->getIntrinsicID()) {
- // Lifetime markers are supported/ignored.
- case llvm::Intrinsic::lifetime_start:
- case llvm::Intrinsic::lifetime_end:
- // Invariant markers are supported/ignored.
- case llvm::Intrinsic::invariant_start:
- case llvm::Intrinsic::invariant_end:
- // Some misc annotations are supported/ignored.
- case llvm::Intrinsic::var_annotation:
- case llvm::Intrinsic::ptr_annotation:
- case llvm::Intrinsic::annotation:
- case llvm::Intrinsic::donothing:
- case llvm::Intrinsic::assume:
- case llvm::Intrinsic::expect:
- // Some debug info intrisics are supported/ignored.
- case llvm::Intrinsic::dbg_value:
- case llvm::Intrinsic::dbg_declare:
- return true;
- default:
- break;
- }
- }
- return false;
-}
-
BlockGenerator::BlockGenerator(PollyIRBuilder &B, LoopInfo &LI,
ScalarEvolution &SE, DominatorTree &DT,
ScalarAllocaMapTy &ScalarMap,
Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Fri Oct 9 18:40:24 2015
@@ -14,12 +14,14 @@
#include "polly/Support/ScopHelper.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
+#include "polly/Support/SCEVValidator.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpander.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/IR/CFG.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
@@ -401,3 +403,43 @@ bool polly::isHoistableLoad(LoadInst *LI
return true;
}
+
+bool polly::isIgnoredIntrinsic(const Value *V) {
+ if (auto *IT = dyn_cast<IntrinsicInst>(V)) {
+ switch (IT->getIntrinsicID()) {
+ // Lifetime markers are supported/ignored.
+ case llvm::Intrinsic::lifetime_start:
+ case llvm::Intrinsic::lifetime_end:
+ // Invariant markers are supported/ignored.
+ case llvm::Intrinsic::invariant_start:
+ case llvm::Intrinsic::invariant_end:
+ // Some misc annotations are supported/ignored.
+ case llvm::Intrinsic::var_annotation:
+ case llvm::Intrinsic::ptr_annotation:
+ case llvm::Intrinsic::annotation:
+ case llvm::Intrinsic::donothing:
+ case llvm::Intrinsic::assume:
+ case llvm::Intrinsic::expect:
+ // Some debug info intrisics are supported/ignored.
+ case llvm::Intrinsic::dbg_value:
+ case llvm::Intrinsic::dbg_declare:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
+bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
+ ScalarEvolution *SE, const Region *R) {
+ if (!V || !SE->isSCEVable(V->getType()))
+ return false;
+
+ if (const SCEV *Scev = SE->getSCEV(const_cast<Value *>(V)))
+ if (!isa<SCEVCouldNotCompute>(Scev))
+ if (!hasScalarDepsInsideRegion(Scev, R))
+ return true;
+
+ return false;
+}
Modified: polly/trunk/lib/Transform/CodePreparation.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/CodePreparation.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/Transform/CodePreparation.cpp (original)
+++ polly/trunk/lib/Transform/CodePreparation.cpp Fri Oct 9 18:40:24 2015
@@ -17,7 +17,6 @@
//===----------------------------------------------------------------------===//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/ScopDetection.h"
#include "polly/Support/ScopHelper.h"
#include "llvm/Analysis/DominanceFrontier.h"
Modified: polly/trunk/lib/Transform/IndependentBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/IndependentBlocks.cpp?rev=249919&r1=249918&r2=249919&view=diff
==============================================================================
--- polly/trunk/lib/Transform/IndependentBlocks.cpp (original)
+++ polly/trunk/lib/Transform/IndependentBlocks.cpp Fri Oct 9 18:40:24 2015
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
//
#include "polly/LinkAllPasses.h"
-#include "polly/CodeGen/BlockGenerators.h"
#include "polly/Options.h"
#include "polly/ScopDetection.h"
#include "polly/Support/ScopHelper.h"
More information about the llvm-commits
mailing list