aboutsummaryrefslogtreecommitdiff
path: root/polly
diff options
context:
space:
mode:
authorSiddharth Bhat <siddu.druid@gmail.com>2017-07-18 09:15:16 +0000
committerSiddharth Bhat <siddu.druid@gmail.com>2017-07-18 09:15:16 +0000
commitedfef5ae8e32b0ded1d97d761b0ea5a1c573ecc4 (patch)
treee662f3c952c997ac3cfd37b53c307ac14ee8c074 /polly
parentdf4100b3d2f29b99f403d8ff63f7780135b5017d (diff)
downloadllvm-edfef5ae8e32b0ded1d97d761b0ea5a1c573ecc4.zip
llvm-edfef5ae8e32b0ded1d97d761b0ea5a1c573ecc4.tar.gz
llvm-edfef5ae8e32b0ded1d97d761b0ea5a1c573ecc4.tar.bz2
[NFC] [PPCGCodeGeneration] cleanup kills related code.
We extended kills in Polly to handle both `phi` nodes and scalars that are not used within the Scop. Update the comments and choice of variable names to reflect this. llvm-svn: 308279
Diffstat (limited to 'polly')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp53
1 files changed, 29 insertions, 24 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index ff583d3..4147498f 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -129,10 +129,12 @@ struct MustKillsInfo {
/// Map from kill statement instances to scalars that need to be
/// killed.
///
- /// We currently only derive kill information for phi nodes, as phi nodes
- /// allow us to easily derive kill information. PHI nodes are not alive
- /// outside the scop and can consequently all be "killed". [params] -> {
- /// [Stmt_phantom[] -> ref_phantom[]] -> phi_ref[] }
+ /// We currently derive kill information for:
+ /// 1. phi nodes. PHI nodes are not alive outside the scop and can
+ /// consequently all be killed.
+ /// 2. Scalar arrays that are not used outside the Scop. This is
+ /// checked by `isScalarUsesContainedInScop`.
+ /// [params] -> { [Stmt_phantom[] -> ref_phantom[]] -> scalar_to_kill[] }
isl::union_map TaggedMustKills;
MustKillsInfo() : KillsSchedule(nullptr), TaggedMustKills(nullptr){};
@@ -185,39 +187,42 @@ static MustKillsInfo computeMustKillsInfo(const Scop &S) {
// at the cost of some code complexity.
Info.KillsSchedule = nullptr;
- for (isl::id &phiId : KillMemIds) {
+ for (isl::id &ToKillId : KillMemIds) {
isl::id KillStmtId = isl::id::alloc(
- S.getIslCtx(), std::string("SKill_phantom_").append(phiId.get_name()),
- nullptr);
+ S.getIslCtx(),
+ std::string("SKill_phantom_").append(ToKillId.get_name()), nullptr);
// NOTE: construction of tagged_must_kill:
// 2. We need to construct a map:
- // [param] -> { [Stmt_phantom[] -> ref_phantom[]] -> phi_ref }
+ // [param] -> { [Stmt_phantom[] -> ref_phantom[]] -> scalar_to_kill[] }
// To construct this, we use `isl_map_domain_product` on 2 maps`:
- // 2a. StmtToPhi:
- // [param] -> { Stmt_phantom[] -> phi_ref[] }
- // 2b. PhantomRefToPhi:
- // [param] -> { ref_phantom[] -> phi_ref[] }
+ // 2a. StmtToScalar:
+ // [param] -> { Stmt_phantom[] -> scalar_to_kill[] }
+ // 2b. PhantomRefToScalar:
+ // [param] -> { ref_phantom[] -> scalar_to_kill[] }
//
// Combining these with `isl_map_domain_product` gives us
// TaggedMustKill:
- // [param] -> { [Stmt[] -> phantom_ref[]] -> memref[] }
+ // [param] -> { [Stmt[] -> phantom_ref[]] -> scalar_to_kill[] }
- // 2a. [param] -> { S_2[] -> phi_ref[] }
- isl::map StmtToPhi = isl::map::universe(isl::space(ParamSpace));
- StmtToPhi = StmtToPhi.set_tuple_id(isl::dim::in, isl::id(KillStmtId));
- StmtToPhi = StmtToPhi.set_tuple_id(isl::dim::out, isl::id(phiId));
+ // 2a. [param] -> { Stmt[] -> scalar_to_kill[] }
+ isl::map StmtToScalar = isl::map::universe(isl::space(ParamSpace));
+ StmtToScalar = StmtToScalar.set_tuple_id(isl::dim::in, isl::id(KillStmtId));
+ StmtToScalar = StmtToScalar.set_tuple_id(isl::dim::out, isl::id(ToKillId));
isl::id PhantomRefId = isl::id::alloc(
- S.getIslCtx(), std::string("ref_phantom") + phiId.get_name(), nullptr);
+ S.getIslCtx(), std::string("ref_phantom") + ToKillId.get_name(),
+ nullptr);
- // 2b. [param] -> { phantom_ref[] -> memref[] }
- isl::map PhantomRefToPhi = isl::map::universe(isl::space(ParamSpace));
- PhantomRefToPhi = PhantomRefToPhi.set_tuple_id(isl::dim::in, PhantomRefId);
- PhantomRefToPhi = PhantomRefToPhi.set_tuple_id(isl::dim::out, phiId);
+ // 2b. [param] -> { phantom_ref[] -> scalar_to_kill[] }
+ isl::map PhantomRefToScalar = isl::map::universe(isl::space(ParamSpace));
+ PhantomRefToScalar =
+ PhantomRefToScalar.set_tuple_id(isl::dim::in, PhantomRefId);
+ PhantomRefToScalar =
+ PhantomRefToScalar.set_tuple_id(isl::dim::out, ToKillId);
- // 2. [param] -> { [Stmt[] -> phantom_ref[]] -> memref[] }
- isl::map TaggedMustKill = StmtToPhi.domain_product(PhantomRefToPhi);
+ // 2. [param] -> { [Stmt[] -> phantom_ref[]] -> scalar_to_kill[] }
+ isl::map TaggedMustKill = StmtToScalar.domain_product(PhantomRefToScalar);
Info.TaggedMustKills = Info.TaggedMustKills.unite(TaggedMustKill);
// 3. Create the kill schedule of the form: