[polly] r230959 - [FIX] Make parallel codegen aware of region statements
Johannes Doerfert
doerfert at cs.uni-saarland.de
Mon Mar 2 05:41:53 PST 2015
Author: jdoerfert
Date: Mon Mar 2 07:41:53 2015
New Revision: 230959
URL: http://llvm.org/viewvc/llvm-project?rev=230959&view=rev
Log:
[FIX] Make parallel codegen aware of region statements
Modified:
polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneration.cpp?rev=230959&r1=230958&r2=230959&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Mon Mar 2 07:41:53 2015
@@ -312,17 +312,9 @@ struct FindValuesUser {
SetVector<const SCEV *> &SCEVs;
};
-/// Extract the values and SCEVs needed to generate code for a ScopStmt.
-///
-/// This function extracts a ScopStmt from a given isl_set and computes the
-/// Values this statement depends on as well as a set of SCEV expressions that
-/// need to be synthesized when generating code for this statment.
-static int findValuesInStmt(isl_set *Set, void *UserPtr) {
- isl_id *Id = isl_set_get_tuple_id(Set);
- struct FindValuesUser &User = *static_cast<struct FindValuesUser *>(UserPtr);
- const ScopStmt *Stmt = static_cast<const ScopStmt *>(isl_id_get_user(Id));
- const BasicBlock *BB = Stmt->getBasicBlock();
-
+/// @brief Extract the values and SCEVs needed to generate code for a block.
+static int findValuesInBlock(struct FindValuesUser &User, const ScopStmt *Stmt,
+ const BasicBlock *BB) {
// Check all the operands of instructions in the basic block.
for (const Instruction &Inst : *BB) {
for (Value *SrcVal : Inst.operands()) {
@@ -340,6 +332,28 @@ static int findValuesInStmt(isl_set *Set
User.Values.insert(SrcVal);
}
}
+ return 0;
+}
+
+/// Extract the values and SCEVs needed to generate code for a ScopStmt.
+///
+/// This function extracts a ScopStmt from a given isl_set and computes the
+/// Values this statement depends on as well as a set of SCEV expressions that
+/// need to be synthesized when generating code for this statment.
+static int findValuesInStmt(isl_set *Set, void *UserPtr) {
+ isl_id *Id = isl_set_get_tuple_id(Set);
+ struct FindValuesUser &User = *static_cast<struct FindValuesUser *>(UserPtr);
+ const ScopStmt *Stmt = static_cast<const ScopStmt *>(isl_id_get_user(Id));
+
+ if (Stmt->isBlockStmt())
+ findValuesInBlock(User, Stmt, Stmt->getBasicBlock());
+ else {
+ assert(Stmt->isRegionStmt() &&
+ "Stmt was neither block nor region statement");
+ for (const BasicBlock *BB : Stmt->getRegion()->blocks())
+ findValuesInBlock(User, Stmt, BB);
+ }
+
isl_id_free(Id);
isl_set_free(Set);
return 0;
More information about the llvm-commits
mailing list