mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-12 10:52:38 +00:00
[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 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
|
||||
/// contained in it.
|
||||
///
|
||||
|
@ -1411,13 +1411,11 @@ void RegionGenerator::generateScalarStores(
|
||||
void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
|
||||
PHINode *PHICopy, BasicBlock *IncomingBB,
|
||||
LoopToScevMapT <S) {
|
||||
Region *StmtR = Stmt.getRegion();
|
||||
|
||||
// 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.
|
||||
BasicBlock *BBCopy = BlockMap[IncomingBB];
|
||||
if (!BBCopy) {
|
||||
assert(StmtR->contains(IncomingBB) &&
|
||||
assert(Stmt.contains(IncomingBB) &&
|
||||
"Bad incoming block for PHI in non-affine region");
|
||||
IncompletePHINodeMap[IncomingBB].push_back(std::make_pair(PHI, PHICopy));
|
||||
return;
|
||||
@ -1428,7 +1426,7 @@ void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
|
||||
|
||||
Value *OpCopy = nullptr;
|
||||
|
||||
if (StmtR->contains(IncomingBB)) {
|
||||
if (Stmt.contains(IncomingBB)) {
|
||||
Value *Op = PHI->getIncomingValueForBlock(IncomingBB);
|
||||
|
||||
// If the current insert block is different from the PHIs incoming block
|
||||
|
Loading…
x
Reference in New Issue
Block a user