<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 class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 28, 2015, at 1:09 PM, Tyler Nowicki <<a href="mailto:tnowicki@apple.com" class="">tnowicki@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class=""><div style="margin: 0px;" class="">To vectorize fp reductions fast-math is required, but this check is done while identifying the reduction causing a very cryptical analysis message. Also it should be possible to provide a loop hint rather than specifying fast-math for the whole module.</div><div style="margin: 0px;" class=""><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">For float reductions the current analysis message reads:</div><div style="margin: 0px;" class="">- value that could not be identified as reduction is used outside the loop</div></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">This patch moves the verification of fast-math, adds a check for a loop hint, and improves the analysis message.</div></div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">The improved message reads:</div><div style="margin: 0px;" class="">- vectorization requires changes in the order of operations, however IEEE 754 floating-point operations are not commutative; allow commutativity by specifying ‘#pragma clang loop vectorize(enable)’ before the loop or by providing the compiler option ‘-ffast-math’</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">In the future I will extend this to include pointer aliasing checks and perhaps cost-model checks.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">This patch builds off of my other diagnostic changes that are currently in review (<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10714&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=vHnTsI60MF8N3P288EHX7QMUzj9_AdNuYP21AOP8y7k&s=RvO_iHoui-SkZIg5Nur2Wkq2FGUhfEARmE6Gjdbn_R8&e=" class="">http://reviews.llvm.org/D10714</a>) and “Renaming and Diagnostics for Loop Interleaving". Please make sure to apply patches 0002 and 0003 if you want to try this patch.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Comments are much appreciated!</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Tyler</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""></div></div><span id="cid:BA6632C3-072F-4867-9456-9F1E18123952@apple.com"><0004-Late-evaluation-of-vectorization-requirements.patch></span><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""></div></div></div></blockquote></div><br class=""></body></html>