[polly] r298617 - [ScopInfo] Introduce ScopStmt::contains(BB*). NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 09:12:21 PDT 2017


Author: meinersbur
Date: Thu Mar 23 11:12:21 2017
New Revision: 298617

URL: http://llvm.org/viewvc/llvm-project?rev=298617&view=rev
Log:
[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 at grosser.es>

Modified:
    polly/trunk/include/polly/ScopInfo.h
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/include/polly/ScopInfo.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopInfo.h?rev=298617&r1=298616&r2=298617&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Mar 23 11:12:21 2017
@@ -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.
   ///

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=298617&r1=298616&r2=298617&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Thu Mar 23 11:12:21 2017
@@ -1411,13 +1411,11 @@ void RegionGenerator::generateScalarStor
 void RegionGenerator::addOperandToPHI(ScopStmt &Stmt, PHINode *PHI,
                                       PHINode *PHICopy, BasicBlock *IncomingBB,
                                       LoopToScevMapT &LTS) {
-  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(Sc
 
   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




More information about the llvm-commits mailing list