[polly] r252445 - Fix non-affine generated entering node not being recognized as dominating
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 8 22:00:23 PST 2015
I had to revert this commit as the unit test is failing. Please check if
it is a simple naming problem or an actual output difference and commit
again afterwards. Thanks!
On 11/09, Michael Kruse via llvm-commits wrote:
> Author: meinersbur
> Date: Sun Nov 8 23:00:30 2015
> New Revision: 252445
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252445&view=rev
> Log:
> Fix non-affine generated entering node not being recognized as dominating
>
> Scalar reloads in the generated entering block were not recognized as
> dominating the subregions locks when there were multiple entering
> nodes. This resulted in values defined in there not being copied.
>
> As a fix, we unconditionally add the BBMap of the generated entering
> node to the generated entry. This fixes part of llvm.org/PR25439.
>
> Added:
> polly/trunk/test/Isl/CodeGen/non-affine-dominance-generated-entering.ll
> Modified:
> polly/trunk/lib/CodeGen/BlockGenerators.cpp
>
> Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=252445&r1=252444&r2=252445&view=diff
> ==============================================================================
> --- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
> +++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sun Nov 8 23:00:30 2015
> @@ -1031,7 +1031,8 @@ void RegionGenerator::copyStmt(ScopStmt
> EntryBBCopy->setName("polly.stmt." + EntryBB->getName() + ".entry");
> Builder.SetInsertPoint(&EntryBBCopy->front());
>
> - generateScalarLoads(Stmt, RegionMaps[EntryBBCopy]);
> + ValueMapT &EntryBBMap = RegionMaps[EntryBBCopy];
> + generateScalarLoads(Stmt, EntryBBMap);
>
> for (auto PI = pred_begin(EntryBB), PE = pred_end(EntryBB); PI != PE; ++PI)
> if (!R->contains(*PI))
> @@ -1054,11 +1055,18 @@ void RegionGenerator::copyStmt(ScopStmt
> // In order to remap PHI nodes we store also basic block mappings.
> BlockMap[BB] = BBCopy;
>
> - // Get the mapping for this block and initialize it with the mapping
> - // available at its immediate dominator (in the new region).
> - ValueMapT &RegionMap = RegionMaps[BBCopy];
> - if (BBCopy != EntryBBCopy)
> - RegionMap = RegionMaps[BBCopyIDom];
> + // Get the mapping for this block and initialize it with either the scalar
> + // loads from the generated entering block (which dominates all blocks of
> + // this subregion) or the maps of the immediate dominator, if part of the
> + // subregion. The latter necessarily includes the former.
> + ValueMapT *InitBBMap;
> + if (BBCopyIDom) {
> + assert(RegionMaps.count(BBCopyIDom));
> + InitBBMap = &RegionMaps[BBCopyIDom];
> + } else
> + InitBBMap = &EntryBBMap;
> + auto Inserted = RegionMaps.insert(std::make_pair(BBCopy, *InitBBMap));
> + ValueMapT &RegionMap = Inserted.first->second;
>
> // Copy the block with the BlockGenerator.
> Builder.SetInsertPoint(&BBCopy->front());
>
> Added: polly/trunk/test/Isl/CodeGen/non-affine-dominance-generated-entering.ll
> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/Isl/CodeGen/non-affine-dominance-generated-entering.ll?rev=252445&view=auto
> ==============================================================================
> --- polly/trunk/test/Isl/CodeGen/non-affine-dominance-generated-entering.ll (added)
> +++ polly/trunk/test/Isl/CodeGen/non-affine-dominance-generated-entering.ll Sun Nov 8 23:00:30 2015
> @@ -0,0 +1,44 @@
> +; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
> +;
> +; llvm.org/PR25439
> +; Scalar reloads in the generated entering block were not recognized as
> +; dominating the subregion blocks when there were multiple entering nodes. This
> +; resulted in values defined in there (here: %cond used in subregionB_entry) not
> +; being copied. We check whether it is reusing the reloaded scalar.
> +;
> +; CHECK-LABEL: polly.stmt.subregionB_entry.exit:
> +; CHECK: store i1 %polly.cond, i1* %cond.s2a
> +;
> +; CHECK-LABEL: polly.stmt.subregionB_entry.entry:
> +; CHECK: %cond.s2a.reload = load i1, i1* %cond.s2a
> +;
> +; CHECK-LABEL: polly.stmt.subregionB_entry:
> +; CHECK: br i1 %cond.s2a.reload
> +
> +define void @func(i32* %A) {
> +entry:
> + br label %subregionA_entry
> +
> +subregionA_entry:
> + %cond = phi i1 [ false, %entry ], [ true, %subregionB_exit ]
> + br i1 %cond, label %subregionA_if, label %subregionA_else
> +
> +subregionA_if:
> + br label %subregionB_entry
> +
> +subregionA_else:
> + br label %subregionB_entry
> +
> +subregionB_entry:
> + store i32 0, i32* %A
> + br i1 %cond, label %subregionB_if, label %subregionB_exit
> +
> +subregionB_if:
> + br label %subregionB_exit
> +
> +subregionB_exit:
> + br i1 false, label %subregionA_entry, label %return
> +
> +return:
> + ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
--
Johannes Doerfert
Researcher / PhD Student
Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.31
Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065 : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151109/618d816c/attachment.sig>
More information about the llvm-commits
mailing list