<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="">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=cksX-CIcHldrH69S3iBKMCVWQcfhE8_8GgD5t1Eaijs&s=377tOG5PLB3Ff8zbeJAYY2uC8gkORWX8h73hY-V4vp8&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></body></html>