<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>No, I’m wrong.  I think that bug is actually in ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>hasFlag</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ itself.  In ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>llvm/lib/Option/ArgList.cpp</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ line #70:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>    bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>                          bool Default) const {<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>      if (Arg *A = getLastArg(Pos, PosAlias, Neg))<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>        return A->getOption().matches(Pos) || A->getOption().matches(PosAlias);<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>      return Default;<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>    }<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>This doesn’t match when ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>Neg</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ is matched, and should probably be:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>    bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>                          bool Default) const {<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>      if (Arg *A = getLastArg(Pos, PosAlias, Neg))<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>        return A->getOption().matches(Pos) || A->getOption().matches(PosAlias);<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>      else<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>        return !A->getOption().matches(Neg) && Default;<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>    }<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>So the logic in ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>CLang.cpp</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ looks valid.  I’ve posted this to LLVM-Dev.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Thanks again,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Martin J. O'Riordan [mailto:MartinO@theheart.ie] <br><b>Sent:</b> 01 March 2018 18:15<br><b>To:</b> 'LLVM Developers' <llvm-dev@lists.llvm.org>; 'Richard Smith' <richard@metafoo.co.uk><br><b>Subject:</b> RE: [cfe-dev] Disabling vectorisation at '-O3'<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Yes, it looks like passing ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>EnableVec</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ and ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>EnableSLPVec</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ to ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>Args.hasFlag</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ should be replaced with ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>false</span><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>’ and then it has the expected behaviour.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> cfe-dev [<a href="mailto:cfe-dev-bounces@lists.llvm.org">mailto:cfe-dev-bounces@lists.llvm.org</a>] <b>On Behalf Of </b>Martin J. O'Riordan via cfe-dev<br><b>Sent:</b> 01 March 2018 18:02<br><b>To:</b> 'Richard Smith' <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br><b>Cc:</b> 'Clang Dev' <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [cfe-dev] Disabling vectorisation at '-O3'<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Thanks Richard, I’ll do that - and I can add it as a bug.  It’s almost certainly easy enough to fix, but I wanted to be sure that I wasn’t just making a naïve mistake.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Richard Smith [<a href="mailto:richard@metafoo.co.uk">mailto:richard@metafoo.co.uk</a>] <br><b>Sent:</b> 01 March 2018 17:44<br><b>To:</b> Martin J. O'Riordan <<a href="mailto:MartinO@theheart.ie">MartinO@theheart.ie</a>><br><b>Cc:</b> Clang Dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [cfe-dev] Disabling vectorisation at '-O3'<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><div><div><p class=MsoNormal>On 1 Mar 2018 09:16, "Martin J. O'Riordan via cfe-dev" <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua",serif'>Hi CFE-Devs,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua",serif'>While debugging a problem in our back-end, I want to temporarily remove JUST ‘</span><span style='font-family:"Courier New"'>-vectorize</span><span style='font-family:"Book Antiqua",serif'>’ and ‘</span><span style='font-family:"Courier New"'>-vectorize-slp</span><span style='font-family:"Book Antiqua",serif'>’ from the flags passed with ‘</span><span style='font-family:"Courier New"'>-cc1</span><span style='font-family:"Book Antiqua",serif'>’, but I want to leave all the other command-line options the same.  But when I use:</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt'><span style='font-family:"Courier New"'>clang -S -O3 -fno-vectorize -fno-slp-vectorize foo.c</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua",serif'>it is still inserting ‘</span><span style='font-family:"Courier New"'>-vectorize -vectorize-slp</span><span style='font-family:"Book Antiqua",serif'>’.  The code in ‘</span><span style='font-family:"Courier New"'>Clang.cpp</span><span style='font-family:"Book Antiqua",serif'>’ for this is at line #4858 (on the v6.0 branch):</span><o:p></o:p></p></div></div></blockquote></div></div><div><p class=MsoNormal>This looks like a bug to me; I'd expect -fno-* to override the -O flag rather than meaning "use the default for this -O level". I'd suggest you look up who added these flags and check with them to make sure this wasn't the intent (it it was, we'll need further discussion), then fix the driver to do the "obvious" thing.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>