<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div dir="ltr" class="">I would also like to get a full diagnostic about why vectorization failed. That is, have -Rpass-missed=loop-vectorize and -Rpass-analysis=loop-vectorize enabled by default.</div></blockquote><div><br class=""></div><div>That’s a good idea, I think it would solve the problem you are seeing. We should enable the remarks for code with a pragma hint. Thinking about the implementation, I can’t say off the top of my head how to pass that information to the BackendConsumer where remarks are emitted. If I get time I’ll do this, but I’m pretty swamped right now.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><span style="font-size:12.8000001907349px" class="">> Its possible there is a bug in the code for generating the warning or we missed generating it somewhere. Could you provide the loop body?<br class=""></span><br class="">I provide a minimal example below (in Appendix A). It seems the diagnostic triggers or not depending on the optimization level selected, which makes sense now that I looked more into it. For example:<br class=""><br class="">When compiling with O0, O2, O3, and Ofast I get no diagnostic, and in fact, the loop is not vectorized because it is actually eliminated.<br class="">When compiling with O1 I get by default without passing any extra flags the diagnostic I wanted: <br class=""><br class="">> file.cpp:13:1: error: loop not vectorized: failed explicitly specified loop<br class="">>      vectorization [-Werror,-Wpass-failed]<br class="">>}<br class="">>^<br class="">><br class="">>1 error generated.<br class=""><br class="">It is also not hard to get "no diagnostic" even for loops that could be vectorized (godbolt+assembly: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__goo.gl_nfeXOX&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=jIb4i5sDntwwu27Y_EOZIIwUil62q8_aKYpdru_Sqxo&s=ugZaTg2kZA8yRkKnHEwV0W2tyP11RD3U1PFMMr9ADEY&e=" target="_blank" class="">http://goo.gl/nfeXOX</a>). In that example, the code is vectorized for a size of 100. But changing the size of 8 removes the vectorization "silently". This is good and makes sense. For a size of 8 it is probably not worth it to vectorize the loop, and whatever cost model the vectorizer uses knows this. <br class=""></div></div></div></blockquote><div><br class=""></div><div>Its an interesting example. When SIZE=8 the loop unroller removes the loop. Actually the vectorizer doesn’t even see it! That makes it difficult to generate a diagnostic in the loop vectorizer. And there are many passes that can remove a loop entirely before it gets to the vectorizer causing the “no diagnostic” problem. Some of these passes generate a remark. For example: -Rpass=unroll says the loop in your example was “completely unrolled loop with 8 iterations”. We should extend the diagnostics to all passes that could remove a loop, such as the LoopDelete pass. In combination with your suggestion above that should resolve the “no diagnostics” problem.</div><div><br class=""></div><div>Thanks for taking the time to generate the example and think about a solution. It's a lot of help!</div><div><br class=""></div><div>Tyler</div></div><br class=""></body></html>