Skip to content

Commit

Permalink
BlockGenerator: Do not store 'store' statements in BBMap
Browse files Browse the repository at this point in the history
A store statement has no return value and can consequently not be referenced
from another statement.

llvm-svn: 244576
  • Loading branch information
tobiasgrosser committed Aug 11, 2015
1 parent 07f31d9 commit c186ac7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
6 changes: 3 additions & 3 deletions polly/include/polly/CodeGen/BlockGenerators.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@ class BlockGenerator {
ValueMapT &BBMap, ValueMapT &GlobalMap,
LoopToScevMapT &LTS);

Value *generateScalarStore(ScopStmt &Stmt, const StoreInst *store,
ValueMapT &BBMap, ValueMapT &GlobalMap,
LoopToScevMapT &LTS);
void generateScalarStore(ScopStmt &Stmt, const StoreInst *store,
ValueMapT &BBMap, ValueMapT &GlobalMap,
LoopToScevMapT &LTS);

/// @brief Copy a single PHI instruction.
///
Expand Down
17 changes: 5 additions & 12 deletions polly/lib/CodeGen/BlockGenerators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,20 +230,16 @@ Value *BlockGenerator::generateScalarLoad(ScopStmt &Stmt, const LoadInst *Load,
return ScalarLoad;
}

Value *BlockGenerator::generateScalarStore(ScopStmt &Stmt,
const StoreInst *Store,
ValueMapT &BBMap,
ValueMapT &GlobalMap,
LoopToScevMapT &LTS) {
void BlockGenerator::generateScalarStore(ScopStmt &Stmt, const StoreInst *Store,
ValueMapT &BBMap, ValueMapT &GlobalMap,
LoopToScevMapT &LTS) {
const Value *Pointer = Store->getPointerOperand();
Value *NewPointer =
generateLocationAccessed(Stmt, Store, Pointer, BBMap, GlobalMap, LTS);
Value *ValueOperand = getNewValue(Stmt, Store->getValueOperand(), BBMap,
GlobalMap, LTS, getLoopForInst(Store));

Value *NewStore = Builder.CreateAlignedStore(ValueOperand, NewPointer,
Store->getAlignment());
return NewStore;
Builder.CreateAlignedStore(ValueOperand, NewPointer, Store->getAlignment());
}

void BlockGenerator::copyInstruction(ScopStmt &Stmt, const Instruction *Inst,
Expand Down Expand Up @@ -275,10 +271,7 @@ void BlockGenerator::copyInstruction(ScopStmt &Stmt, const Instruction *Inst,
}

if (const StoreInst *Store = dyn_cast<StoreInst>(Inst)) {
Value *NewStore = generateScalarStore(Stmt, Store, BBMap, GlobalMap, LTS);
// Compute NewStore before its insertion in BBMap to make the insertion
// deterministic.
BBMap[Store] = NewStore;
generateScalarStore(Stmt, Store, BBMap, GlobalMap, LTS);
return;
}

Expand Down

0 comments on commit c186ac7

Please sign in to comment.