Add end user report message for unprofitable regions [NFC]

llvm-svn: 231593
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 01d8dde..ebe175f 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -761,12 +761,15 @@
 }
 
 void ScopDetection::findScops(Region &R) {
-  if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
-    return;
-
   DetectionContext Context(R, *AA, NonAffineSubRegionMap[&R],
                            false /*verifying*/);
-  bool RegionIsValid = isValidRegion(Context);
+
+  bool RegionIsValid = false;
+  if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
+    invalid<ReportUnprofitable>(Context, /*Assert=*/true, &R);
+  else
+    RegionIsValid = isValidRegion(Context);
+
   bool HasErrors = !RegionIsValid || Context.Log.size() > 0;
 
   if (PollyTrackFailures && HasErrors)
@@ -905,7 +908,7 @@
   // We can probably not do a lot on scops that only write or only read
   // data.
   if (!DetectUnprofitable && (!Context.hasStores || !Context.hasLoads))
-    invalid<ReportUnprofitable>(Context, /*Assert=*/true);
+    invalid<ReportUnprofitable>(Context, /*Assert=*/true, &CurRegion);
 
   DEBUG(dbgs() << "OK\n");
   return true;