Add Rpass-missed and Rpass-analysis reports to the loop vectorizer

Arnold Schwaighofer aschwaighofer at apple.com
Wed Jun 11 13:42:01 PDT 2014


+  if (!TheLoop->getLoopPreheader()) {
+    emitAnalysis(
+        Report()
+        << "loop initiation control flow is not understood by vectorizer");

Lets call this “loop control flow is not understood by vectorizer”.

+  if (!TheLoop->getExitingBlock()) {
+    emitAnalysis(
+        Report()
+        << "loop termination control flow is not understood by vectorizer");

Same here.

In both cases the vectorizer gives up because the loop could not be simplified to a canonical form.


@@ -3386,13 +3463,17 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
         if (*bb != Header) {
           // Check that this instruction has no outside users or is an
           // identified reduction value with an outside user.
-          if(!hasOutsideLoopUser(TheLoop, it, AllowedExit))
+          if (!hasOutsideLoopUser(TheLoop, it, AllowedExit))
             continue;
+          emitAnalysis(Report(it) << "value cannot be used outside the loop");

“value that could not be identified as reduction is used outside the loop”

+          DEBUG(dbgs() << "LV: Found an non-int non-pointer PHI.\n");
What happened here?
           return false;
         }

           // Until we explicitly handle the case of an induction variable with
           // an outside loop user we have to give up vectorizing this loop.
-          if (hasOutsideLoopUser(TheLoop, it, AllowedExit))
+          if (hasOutsideLoopUser(TheLoop, it, AllowedExit)) {
+            emitAnalysis(Report(it) << "value cannot be used outside the loop");

“induction value uses outside of the loop not handle by vectorizer"


   if (!Induction) {
     DEBUG(dbgs() << "LV: Did not find one integer induction var.\n");
-    if (Inductions.empty())
+    if (Inductions.empty()) {
+      emitAnalysis(
+          Report()
+          << "integer type loop induction variable could not be identified");

The debug statement above is misleading.

“loop induction variable could not be identified”

(The vectorizer also handles pointer inductions.)


+        if (!Ld || (!Ld->isSimple() && !IsAnnotatedParallel)) {
+          emitAnalysis(Report(Ld) << "non-simple read from memory");

A “isSimple()” load is a plain load without atomic ordering constraints or volatile specifier.

“read with atomic ordering or volatile read”

Similar for store:

         if (!St->isSimple() && !IsAnnotatedParallel) {
+          emitAnalysis(Report(St) << "non-simple write to memory");

“write with atomic ordering or volatile write”

     if (isUniform(Ptr)) {
+      emitAnalysis(Report(ST) << "memory write could not be vectorized");

“write to a loop invariant address could not be vectorized"

> On Jun 11, 2014, at 1:12 PM, Tyler Nowicki <tnowicki at apple.com> wrote:
> 
> <vectorization_diagnostics.patch>





More information about the llvm-commits mailing list