[PATCH] D12259: Improved Diagnostics and Extended vectorize(enable)

Tyler Nowicki via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 18:19:38 PDT 2015


tyler.nowicki added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:933-934
@@ +932,4 @@
+      return LV_NAME;
+    if (getForce() == LoopVectorizeHints::FK_Undefined && getWidth() == 0)
+      return LV_NAME;
+    return DiagnosticInfo::AlwaysPrint;
----------------
mzolotukhin wrote:
> Don't we start returning `AlwaysPrint` for all vectorized loops if no hint is specified (`getForce() == LoopVectorizeHints::FK_Undefined`, `getWidth() == 4/8/16`)?
No. Only when a hint is specified. This really means that the user only sees the analysis when vectorization fails on a loop with the hint enabled. If vectorization is possible, the user rarely sees any analysis. If there is something wrong with the loop then they will see the analysis.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1538
@@ +1537,3 @@
+                                VectorizerParams::RuntimeMemoryCheckThreshold &&
+                            !Hints.allowReordering();
+    if (ThresholdReached || PragmaThresholdReached) {
----------------
mzolotukhin wrote:
> Why is `allowReordering` a part of `ThresholdReached`?
So vectorize(enable) can be used to override the threshold. But a comment in another discussion asked for another maximum threshold to prevent huge code. Thus we have two thresholds.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1823-1825
@@ -1803,5 +1822,5 @@
       // Do not vectorize or interleaving the loop.
-      emitOptimizationRemarkAnalysis(F->getContext(), DEBUG_TYPE, *F,
+      emitOptimizationRemarkAnalysis(F->getContext(), VAPassName, *F,
                                      L->getStartLoc(), VecDiagMsg);
-      emitOptimizationRemarkAnalysis(F->getContext(), DEBUG_TYPE, *F,
+      emitOptimizationRemarkAnalysis(F->getContext(), LV_NAME, *F,
                                      L->getStartLoc(), IntDiagMsg);
----------------
mzolotukhin wrote:
> Why do we distinguish these two? If we don't want to see one of them in -R-reports, should we just make it `DEBUG(dbgs() << "...")` instead of `emitOptimizationRemarkAnalysis`?
Vectorization analysis remarks are Always Printed when a vectorization loop hint is provided. We don't want to print interleaving analysis remarks when a vectorization loop hint is provided.

In the future we should, but that is for another patch. Part of the changes that should go in related to thise include detangling the metadata for enabling vectorization. Right now interleave(enable) and vectorize(enable) use the same metadata ...vectorize.enable.


http://reviews.llvm.org/D12259





More information about the llvm-commits mailing list