// PHI nodes are modeled as if they had been demoted prior to the SCoP
// detection. Hence, the PHI is a load of a new memory location in which the
// incoming value was written at the end of the incoming basic block.
- bool Written = false;
+ bool OnlyNonAffineSubRegionOperands = true;
for (unsigned u = 0; u < PHI->getNumIncomingValues(); u++) {
Value *Op = PHI->getIncomingValue(u);
BasicBlock *OpBB = PHI->getIncomingBlock(u);
- if (!R.contains(OpBB))
- continue;
-
// Do not build scalar dependences inside a non-affine subregion.
if (NonAffineSubRegion && NonAffineSubRegion->contains(OpBB))
continue;
+ OnlyNonAffineSubRegionOperands = false;
+
+ if (!R.contains(OpBB))
+ continue;
+
Instruction *OpI = dyn_cast<Instruction>(Op);
if (OpI) {
BasicBlock *OpIBB = OpI->getParent();
if (!OpI)
OpI = OpBB->getTerminator();
- Written = true;
-
IRAccess ScalarAccess(IRAccess::MUST_WRITE, PHI, ZeroOffset, 1, true,
/* IsPHI */ true);
AccFuncMap[OpBB].push_back(std::make_pair(ScalarAccess, OpI));
}
- if (Written) {
+ if (!OnlyNonAffineSubRegionOperands) {
IRAccess ScalarAccess(IRAccess::READ, PHI, ZeroOffset, 1, true,
/* IsPHI */ true);
Functions.push_back(std::make_pair(ScalarAccess, PHI));
; PHI node. LCSSA may create such PHI nodes. This is a breakdown of this case in
; the function 'Laguerre_With_Deflation' of oggenc from LLVM's test-suite.
;
-; XFAIL: *
-;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @test(i64 %n, float* noalias nonnull %A, float %a) {
entry:
br label %entry.split
+; CHECK-LABEL: %polly.split_new_and_old
+; CHECK-NEXT: store float %a, float* %b.phiops
+
+; CHECK-LABEL: polly.stmt.entry.split
+; CHECK-NEXT: %b.phiops.reload = load float, float* %b.phiops
+
entry.split:
%b = phi float [ %a, %entry ]
store float %b, float* %A, align 4