Also build scalar dependences for store instructions

While ignoring read-only scalar dependences it was not necessary to consider
store instructins, but as store instructions can be the target of a scalar
read-only dependency we need to consider them for the construction of scalar
read-only dependences.

llvm-svn: 246429
This commit is contained in:
Tobias Grosser 2015-08-31 11:15:00 +00:00
parent 2ae0fe3ac3
commit 44b34b0e8a
2 changed files with 11 additions and 6 deletions

View File

@ -317,13 +317,14 @@ void TempScopInfo::buildAccessFunctions(Region &R, BasicBlock &BB,
if (PHINode *PHI = dyn_cast<PHINode>(Inst))
buildPHIAccesses(PHI, R, Functions, NonAffineSubRegion);
if (!isa<StoreInst>(Inst) &&
buildScalarDependences(Inst, &R, NonAffineSubRegion)) {
if (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));
if (!isa<StoreInst>(Inst)) {
IRAccess ScalarAccess(IRAccess::MUST_WRITE, Inst, ZeroOffset, 1, true,
Inst);
Functions.push_back(std::make_pair(ScalarAccess, Inst));
}
}
}

View File

@ -10,8 +10,11 @@
; SCALARS: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALARS: { Stmt_stmt1[i0] -> MemRef_scalar[] };
; SCALARS: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
; SCALARS: { Stmt_stmt1[i0] -> MemRef_scalar2[] };
define void @foo(float* noalias %A, float %scalar) {
define void @foo(float* noalias %A, float* %B, float %scalar, float %scalar2) {
entry:
br label %loop
@ -23,6 +26,7 @@ stmt1:
%val = load float, float* %A
%sum = fadd float %val, %scalar
store float %sum, float* %A
store float %scalar2, float* %B
br label %loop.backedge
loop.backedge: