[ScheduleOptimizer] Add -polly-opt-outer-coincidence option.

Add a command line switch to set the
isl_options_set_schedule_outer_coincidence option. ISL then tries to
build schedules where the outer member of a band satisfies the
coincidence constraints.

In practice this allows loop skewing for more parallelism in inner
loops.

llvm-svn: 268222
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp
index 6702c53..b517879 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -102,6 +102,12 @@
                       cl::desc("Maximize the band depth (yes/no)"), cl::Hidden,
                       cl::init("yes"), cl::ZeroOrMore, cl::cat(PollyCategory));
 
+static cl::opt<std::string> OuterCoincidence(
+    "polly-opt-outer-coincidence",
+    cl::desc("Try to construct schedules where the outer member of each band "
+             "satisfies the coincidence constraints (yes/no)"),
+    cl::Hidden, cl::init("no"), cl::ZeroOrMore, cl::cat(PollyCategory));
+
 static cl::opt<int> PrevectorWidth(
     "polly-prevect-width",
     cl::desc(
@@ -543,6 +549,20 @@
     IslMaximizeBands = 1;
   }
 
+  int IslOuterCoincidence;
+
+  if (OuterCoincidence == "yes") {
+    IslOuterCoincidence = 1;
+  } else if (OuterCoincidence == "no") {
+    IslOuterCoincidence = 0;
+  } else {
+    errs() << "warning: Option -polly-opt-outer-coincidence should either be "
+              "'yes' or 'no'. Falling back to default: 'no'\n";
+    IslOuterCoincidence = 0;
+  }
+
+  isl_options_set_schedule_outer_coincidence(S.getIslCtx(),
+                                             IslOuterCoincidence);
   isl_options_set_schedule_serialize_sccs(S.getIslCtx(), IslSerializeSCCs);
   isl_options_set_schedule_maximize_band_depth(S.getIslCtx(), IslMaximizeBands);
   isl_options_set_schedule_max_constant_term(S.getIslCtx(), MaxConstantTerm);