forked from OSchip/llvm-project
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:
parent
2ae0fe3ac3
commit
44b34b0e8a
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue