forked from OSchip/llvm-project
[ScopInfo] Introduce ScopStmt::contains(BB*). NFC.
Provide an common way for testing if a statement contains something for region and block statements. First user is RegionGenerator::addOperandToPHI. Suggested-by: Tobias Grosser <tobias@grosser.es> llvm-svn: 298617
This commit is contained in:
parent
1c048ab6ba
commit
c3e9c1442d
|
@ -1324,6 +1324,15 @@ public:
|
||||||
return getRegion()->contains(L);
|
return getRegion()->contains(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return whether this statement contains @p BB.
|
||||||
|
bool contains(BasicBlock *BB) const {
|
||||||
|
if (isCopyStmt())
|
||||||
|
return false;
|
||||||
|
if (isBlockStmt())
|
||||||
|
return BB == getBasicBlock();
|
||||||
|
return getRegion()->contains(BB);
|
||||||
|
}
|
||||||
|
|
||||||
/// Return the closest innermost loop that contains this statement, but is not
|
/// Return the closest innermost loop that contains this statement, but is not
|
||||||
/// contained in it.
|
/// contained in it.
|
||||||
///
|
///
|
||||||
|
|
|
@ -1411,13 +1411,11 @@ void RegionGenerator::generateScalarStores(
|
||||||
void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
|
void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
|
||||||
PHINode *PHICopy, BasicBlock *IncomingBB,
|
PHINode *PHICopy, BasicBlock *IncomingBB,
|
||||||
LoopToScevMapT <S) {
|
LoopToScevMapT <S) {
|
||||||
Region *StmtR = Stmt.getRegion();
|
|
||||||
|
|
||||||
// If the incoming block was not yet copied mark this PHI as incomplete.
|
// If the incoming block was not yet copied mark this PHI as incomplete.
|
||||||
// Once the block will be copied the incoming value will be added.
|
// Once the block will be copied the incoming value will be added.
|
||||||
BasicBlock *BBCopy = BlockMap[IncomingBB];
|
BasicBlock *BBCopy = BlockMap[IncomingBB];
|
||||||
if (!BBCopy) {
|
if (!BBCopy) {
|
||||||
assert(StmtR->contains(IncomingBB) &&
|
assert(Stmt.contains(IncomingBB) &&
|
||||||
"Bad incoming block for PHI in non-affine region");
|
"Bad incoming block for PHI in non-affine region");
|
||||||
IncompletePHINodeMap[IncomingBB].push_back(std::make_pair(PHI, PHICopy));
|
IncompletePHINodeMap[IncomingBB].push_back(std::make_pair(PHI, PHICopy));
|
||||||
return;
|
return;
|
||||||
|
@ -1428,7 +1426,7 @@ void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
|
||||||
|
|
||||||
Value *OpCopy = nullptr;
|
Value *OpCopy = nullptr;
|
||||||
|
|
||||||
if (StmtR->contains(IncomingBB)) {
|
if (Stmt.contains(IncomingBB)) {
|
||||||
Value *Op = PHI->getIncomingValueForBlock(IncomingBB);
|
Value *Op = PHI->getIncomingValueForBlock(IncomingBB);
|
||||||
|
|
||||||
// If the current insert block is different from the PHIs incoming block
|
// If the current insert block is different from the PHIs incoming block
|
||||||
|
|
Loading…
Reference in New Issue