Index: include/polly/ScopInfo.h =================================================================== --- include/polly/ScopInfo.h +++ include/polly/ScopInfo.h @@ -1157,6 +1157,9 @@ ScopStmt(Scop &parent, __isl_take isl_map *SourceRel, __isl_take isl_map *TargetRel, __isl_take isl_set *Domain); + /// Vector for Instructions in a BB. + std::vector Instructions; + /// Initialize members after all MemoryAccesses have been added. void init(LoopInfo &LI); @@ -1249,9 +1252,6 @@ /// The closest loop that contains this statement. Loop *SurroundingLoop; - /// Vector for Instructions in a BB. - std::vector Instructions; - /// Build the statement. //@{ void buildDomain(); Index: lib/CodeGen/BlockGenerators.cpp =================================================================== --- lib/CodeGen/BlockGenerators.cpp +++ lib/CodeGen/BlockGenerators.cpp @@ -441,8 +441,12 @@ 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.Instructions) + copyInstruction(Stmt, Inst, BBMap, LTS, NewAccesses); + else + for (Instruction &Inst : *BB) + copyInstruction(Stmt, &Inst, BBMap, LTS, NewAccesses); } Value *BlockGenerator::getOrCreateAlloca(const MemoryAccess &Access) {