diff options
| author | Michael Kruse <llvm@meinersbur.de> | 2015-11-09 05:00:30 +0000 |
|---|---|---|
| committer | Michael Kruse <llvm@meinersbur.de> | 2015-11-09 05:00:30 +0000 |
| commit | fd9c89e84bc4996ef8c7dac7f8a0e60d79b564d1 (patch) | |
| tree | 523a0f58b9c9e631b5ccab885bbc6fd2504edfbb /polly/lib/CodeGen/BlockGenerators.cpp | |
| parent | d5537bf2194058332ee53bb8fad2dde97f70f55a (diff) | |
| download | bcm5719-llvm-fd9c89e84bc4996ef8c7dac7f8a0e60d79b564d1.tar.gz bcm5719-llvm-fd9c89e84bc4996ef8c7dac7f8a0e60d79b564d1.zip | |
Fix non-affine generated entering node not being recognized as dominating
Scalar reloads in the generated entering block were not recognized as
dominating the subregions locks when there were multiple entering
nodes. This resulted in values defined in there not being copied.
As a fix, we unconditionally add the BBMap of the generated entering
node to the generated entry. This fixes part of llvm.org/PR25439.
llvm-svn: 252445
Diffstat (limited to 'polly/lib/CodeGen/BlockGenerators.cpp')
| -rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index ace05a3038e..ecfb857aab2 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -1031,7 +1031,8 @@ void RegionGenerator::copyStmt(ScopStmt &Stmt, LoopToScevMapT <S, EntryBBCopy->setName("polly.stmt." + EntryBB->getName() + ".entry"); Builder.SetInsertPoint(&EntryBBCopy->front()); - generateScalarLoads(Stmt, RegionMaps[EntryBBCopy]); + ValueMapT &EntryBBMap = RegionMaps[EntryBBCopy]; + generateScalarLoads(Stmt, EntryBBMap); for (auto PI = pred_begin(EntryBB), PE = pred_end(EntryBB); PI != PE; ++PI) if (!R->contains(*PI)) @@ -1054,11 +1055,18 @@ void RegionGenerator::copyStmt(ScopStmt &Stmt, LoopToScevMapT <S, // In order to remap PHI nodes we store also basic block mappings. BlockMap[BB] = BBCopy; - // Get the mapping for this block and initialize it with the mapping - // available at its immediate dominator (in the new region). - ValueMapT &RegionMap = RegionMaps[BBCopy]; - if (BBCopy != EntryBBCopy) - RegionMap = RegionMaps[BBCopyIDom]; + // Get the mapping for this block and initialize it with either the scalar + // loads from the generated entering block (which dominates all blocks of + // this subregion) or the maps of the immediate dominator, if part of the + // subregion. The latter necessarily includes the former. + ValueMapT *InitBBMap; + if (BBCopyIDom) { + assert(RegionMaps.count(BBCopyIDom)); + InitBBMap = &RegionMaps[BBCopyIDom]; + } else + InitBBMap = &EntryBBMap; + auto Inserted = RegionMaps.insert(std::make_pair(BBCopy, *InitBBMap)); + ValueMapT &RegionMap = Inserted.first->second; // Copy the block with the BlockGenerator. Builder.SetInsertPoint(&BBCopy->front()); |

