[polly] r304502 - [CodeGen] Iterate over explicit instruction list for block statements. NFC

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 17:13:49 PDT 2017


Author: meinersbur
Date: Thu Jun  1 19:13:49 2017
New Revision: 304502

URL: http://llvm.org/viewvc/llvm-project?rev=304502&view=rev
Log:
[CodeGen] Iterate over explicit instruction list for block statements. NFC

For when statements do not contain all instructions of a BasicBlock
anymore, the block generator needs to go through the explicit list of
instructions it contains.

Contributed-by: Nandini Singhal <cs15mtech01004 at iith.ac.in>

Differential Revision: https://reviews.llvm.org/D33653

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=304502&r1=304501&r2=304502&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopInfo.h (original)
+++ polly/trunk/include/polly/ScopInfo.h Thu Jun  1 19:13:49 2017
@@ -1502,6 +1502,10 @@ public:
   Scop *getParent() { return &Parent; }
   const Scop *getParent() const { return &Parent; }
 
+  const std::vector<Instruction *> &getInstructions() const {
+    return Instructions;
+  }
+
   const char *getBaseName() const;
 
   /// Set the isl AST build.

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=304502&r1=304501&r2=304502&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Thu Jun  1 19:13:49 2017
@@ -441,8 +441,12 @@ void BlockGenerator::copyBB(ScopStmt &St
                             isl_id_to_ast_expr *NewAccesses) {
   EntryBB = &CopyBB->getParent()->getEntryBlock();
 
-  for (Instruction &Inst : *BB)
-    copyInstruction(Stmt, &Inst, BBMap, LTS, NewAccesses);
+  if (Stmt.isBlockStmt())
+    for (Instruction *Inst : Stmt.getInstructions())
+      copyInstruction(Stmt, Inst, BBMap, LTS, NewAccesses);
+  else
+    for (Instruction &Inst : *BB)
+      copyInstruction(Stmt, &Inst, BBMap, LTS, NewAccesses);
 }
 
 Value *BlockGenerator::getOrCreateAlloca(const MemoryAccess &Access) {




More information about the llvm-commits mailing list