CodeGen: Allow Polly to do 'grouped unrolling', but no vector generation.

Grouped unrolling means that we unroll a loop such that the different instances
of a certain statement are scheduled right after each other, but we do
not generate any vector code. The idea here is that we can schedule the
bb vectorizer right afterwards and use it heuristics to decide when
vectorization should be performed.

llvm-svn: 154251
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 32e7a25..903ed38 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -84,6 +84,12 @@
        cl::value_desc("OpenMP code generation enabled if true"),
        cl::init(false), cl::ZeroOrMore);
 
+static cl::opt<bool>
+GroupedUnrolling("enable-polly-grouped-unroll",
+                 cl::desc("Perform grouped unrolling, but don't generate SIMD "
+                          "instuctions"), cl::Hidden, cl::init(false),
+                 cl::ZeroOrMore);
+
 typedef DenseMap<const Value*, Value*> ValueMapT;
 typedef DenseMap<const char*, Value*> CharMapT;
 typedef std::vector<ValueMapT> VectorValueMapT;
@@ -676,6 +682,14 @@
                                         VectorValueMapT &ScalarMaps) {
   Value *NewLoad;
 
+  if (GroupedUnrolling) {
+    for (int i = 0; i < getVectorWidth(); i++)
+      ScalarMaps[i][Load] = generateScalarLoad(Load, ScalarMaps[i],
+                                               GlobalMaps[i]);
+
+    return;
+  }
+
   MemoryAccess &Access = Statement.getAccessFor(Load);
 
   if (Access.isStrideZero(isl_set_copy(Domain)))