<div dir="auto"><div class="gmail_extra" dir="auto"><div class="gmail_quote">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:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-IE" link="#0563C1" vlink="#954F72"><div class="m_-1031956201613204138WordSection1"><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">Hi CFE-Devs,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">While debugging a problem in our back-end, I want to temporarily remove JUST ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-vectorize</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ and ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-vectorize-slp</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ from the flags passed with ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-cc1</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’, but I want to leave all the other command-line options the same.  But when I use:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">clang -S -O3 -fno-vectorize -fno-slp-vectorize foo.c<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">it is still inserting ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-vectorize -vectorize-slp</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’.  The code in ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">Clang.cpp</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ for this is at line #4858 (on the v6.0 branch):<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  // Enable vectorization per default according to the optimization level<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  // selected. For optimization levels that want vectorization we use the alias<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  // option to simplify the hasFlag logic.<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  bool EnableVec = shouldEnableVectorizerAtOLevel<wbr>(Args, false);<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  OptSpecifier VectorizeAliasOption =<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">      EnableVec ? options::OPT_O_Group : options::OPT_fvectorize;<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  if (Args.hasFlag(options::OPT_<wbr>fvectorize, VectorizeAliasOption,<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">                   options::OPT_fno_vectorize, EnableVec))<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">    CmdArgs.push_back("-vectorize-<wbr>loops");<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New""><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  // -fslp-vectorize is enabled based on the optimization level selected.<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  bool EnableSLPVec = shouldEnableVectorizerAtOLevel<wbr>(Args, true);<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  OptSpecifier SLPVectAliasOption =<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">      EnableSLPVec ? options::OPT_O_Group : options::OPT_fslp_vectorize;<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">  if (Args.hasFlag(options::OPT_<wbr>fslp_vectorize, SLPVectAliasOption,<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">                   options::OPT_fno_slp_<wbr>vectorize, EnableSLPVec))<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:12.0pt;font-family:"Courier New"">    CmdArgs.push_back("-vectorize-<wbr>slp");<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">but this is ignoring the ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-fno-*</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ flags and overriding because of the presence of ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-O3</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ and the defaults for ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-O3</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">Am I just using ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">clang</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ incorrectly, and if so, how can I achieve what I am trying to achieve?  I don’t want to use ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-O0</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ or ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-O1</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ because I still want all of the other options passed as usual with ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-cc1</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’ as would normally be passed with ‘</span><span style="font-size:12.0pt;font-family:"Courier New"">-O3</span><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">’.  I am not just debugging one file, but would like to build hundreds of sources with the amended options by just changing some variables in the Makefiles to see what the impact is.</span></p></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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.</div><div dir="auto"><br></div><div class="gmail_extra" dir="auto"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-IE" link="#0563C1" vlink="#954F72"><div class="m_-1031956201613204138WordSection1"><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif">            MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Book Antiqua",serif"><u></u> <u></u></span></p></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>