diff options
| author | Tobias Grosser <tobias@grosser.es> | 2015-08-30 15:03:59 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2015-08-30 15:03:59 +0000 |
| commit | 2985400a0e3437ddec523563b9403347c8bcd85f (patch) | |
| tree | 5841ac3724e644c22bc479e4013da139382001cf /polly/lib/CodeGen/BlockGenerators.cpp | |
| parent | 51b65d937078e7afe3d180abcf270a44b82bd3d4 (diff) | |
Remove isNew from getOrCreateAlloca
This commit drops some dead code. Specifically, there is no need to initialize
the virtual memory locations of scalars in BlockGenerator::handleOutsideUsers,
the function that initalizes the escape map that keeps track of out-of-scope
uses of scalar values. We already model instructions inside the scop that
are used outside the scope (escaping instructions) as scalar memory writes at
the position of the instruction. As a result, the virtual memory location of
this instructions is already initialized when code-generating the corresponding
virtual scalar write and consequently does not need to be initialized later on
when generating the set of escaping values.
Code references:
In TempScopInfo::buildScalarDependences we detect scalar cross-statement
dependences for all instructions (including PHIs) that have uses outside of the
scop's region:
// Check whether or not the use is in the SCoP.
if (!R->contains(UseParent)) {
AnyCrossStmtUse = true;
continue;
}
We use this information in TempScopInfo::buildAccessFunctions were we build
scalar write memory accesses for all these instructions:
if (!isa<StoreInst>(Inst) &&
buildScalarDependences(Inst, &R, NonAffineSubRegion)) {
// If the Instruction is used outside the statement, we need to build the
// write access.
IRAccess ScalarAccess(IRAccess::MUST_WRITE, Inst, ZeroOffset, 1, true,
Inst);
Functions.push_back(std::make_pair(ScalarAccess, Inst));
}
Reviewers: jdoerfert
Subscribers: pollydev, llvm-commits
Differential Revision: http://reviews.llvm.org/D12472
llvm-svn: 246383
Diffstat (limited to 'polly/lib/CodeGen/BlockGenerators.cpp')
| -rw-r--r-- | polly/lib/CodeGen/BlockGenerators.cpp | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp index c4bbbf4923e8..58d179415da7 100644 --- a/polly/lib/CodeGen/BlockGenerators.cpp +++ b/polly/lib/CodeGen/BlockGenerators.cpp @@ -342,16 +342,10 @@ void BlockGenerator::copyBB(ScopStmt &Stmt, BasicBlock *BB, BasicBlock *CopyBB, AllocaInst *BlockGenerator::getOrCreateAlloca(Value *ScalarBase, ScalarAllocaMapTy &Map, - const char *NameExt, - bool *IsNew) { - + const char *NameExt) { // Check if an alloca was cached for the base instruction. AllocaInst *&Addr = Map[ScalarBase]; - // If needed indicate if it was found already or will be created. - if (IsNew) - *IsNew = (Addr == nullptr); - // If no alloca was found create one and insert it in the entry block. if (!Addr) { auto *Ty = ScalarBase->getType(); @@ -379,11 +373,9 @@ AllocaInst *BlockGenerator::getOrCreatePHIAlloca(Value *ScalarBase) { void BlockGenerator::handleOutsideUsers(const Region &R, Instruction *Inst, Value *InstCopy) { - // If there are escape users we get the alloca for this instruction and put - // it in the EscapeMap for later finalization. However, if the alloca was not - // created by an already handled scalar dependence we have to initialize it - // also. Lastly, if the instruction was copied multiple times we already did - // this and can exit. + // If there are escape users we get the alloca for this instruction and put it + // in the EscapeMap for later finalization. Lastly, if the instruction was + // copied multiple times we already did this and can exit. if (EscapeMap.count(Inst)) return; @@ -406,19 +398,10 @@ void BlockGenerator::handleOutsideUsers(const Region &R, Instruction *Inst, return; // Get or create an escape alloca for this instruction. - bool IsNew; - AllocaInst *ScalarAddr = - getOrCreateAlloca(Inst, ScalarMap, ".escape", &IsNew); + AllocaInst *ScalarAddr = getOrCreateScalarAlloca(Inst); // Remember that this instruction has escape uses and the escape alloca. EscapeMap[Inst] = std::make_pair(ScalarAddr, std::move(EscapeUsers)); - - // If the escape alloca was just created store the instruction in there, - // otherwise that happened already. - if (IsNew) { - assert(InstCopy && "Except PHIs every instruction should have a copy!"); - Builder.CreateStore(InstCopy, ScalarAddr); - } } void BlockGenerator::generateScalarLoads(ScopStmt &Stmt, |
