forked from OSchip/llvm-project
[FIX] Make parallel codegen aware of region statements
llvm-svn: 230959
This commit is contained in:
parent
6100f61bce
commit
bbf3084561
|
@ -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, void *UserPtr) {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue