<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em seg., 13 de dez. de 2021 às 07:45, David Spickett <<a href="mailto:david.spickett@linaro.org">david.spickett@linaro.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Caveat that I'm on shaky ground when it comes to my understanding of<br>
how the pass managers work.<br>
<br>
I think clang 13 uses the new pass manager, so this would be what you want:<br>
$ ./bin/clang /tmp/test.c -c -o /dev/null -O1 -Xclang -fdebug-pass-manager<br></blockquote><div><br></div><div>Someone suggested looking into Alias Analysis as well.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Certainly I see a lot of differences trying that myself.<br>
(<a href="https://llvm.org/docs/NewPassManager.html#invoking-opt" rel="noreferrer" target="_blank">https://llvm.org/docs/NewPassManager.html#invoking-opt</a>)<br>
<br>
That tells you what the target generic passes being run are, then the<br>
target specific things use the old pass manager which you can use<br>
"-mllvm -debug-pass=Structure" for instead.<br>
(<a href="https://llvm.org/docs/NewPassManager.html#status-of-the-new-and-legacy-pass-managers" rel="noreferrer" target="_blank">https://llvm.org/docs/NewPassManager.html#status-of-the-new-and-legacy-pass-managers</a>)<br>
<br>
How you get an option from clang to opt to change which passes are<br>
run, I couldn't work out. There is "-passes=" for opt but that won't<br>
get through from clang with "-mllvm", maybe I just didn't do it<br>
correctly.<br>
<br>
Though I found a good suggestion from Medhi Amini in another thread,<br>
that would mean you could use opt directly:<br>
"But you may start by bisecting the input files compiling half of them<br>
with O1 and the other half with O0 and recurse till you find the file<br>
that is miscompiled with O1. Then you can use opt to test variant of<br>
the pipeline on this file and relink manually."<br>
(<a href="https://groups.google.com/g/llvm-dev/c/Y1HHgpmBidM" rel="noreferrer" target="_blank">https://groups.google.com/g/llvm-dev/c/Y1HHgpmBidM</a>)<br>
<br></blockquote><div><br></div><div>I see, but I was thinking about something simpler: adding -O2 and -fno-foo flags to disable optimizations (e.g., -fno-slp-vectorizer), WDYT?</div><div><br></div><div>I've found this post from '14 about that: <a href="https://stackoverflow.com/questions/15548023/clang-optimization-levels">https://stackoverflow.com/questions/15548023/clang-optimization-levels</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hope that helps but in any case please go ahead and open an issue and<br>
we can narrow it down further.<br></blockquote><div><br></div><div>Done: <a href="https://github.com/llvm/llvm-project/issues/52669">https://github.com/llvm/llvm-project/issues/52669</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
On Mon, 13 Dec 2021 at 10:27, David Spickett <<a href="mailto:david.spickett@linaro.org" target="_blank">david.spickett@linaro.org</a>> wrote:<br>
><br>
> FWIW I think opening an issue with what you've got would be fine.<br>
><br>
> > when I build JSC using either -O2 or -O3, I get random garbage when querying for the "Infinity" constant from javascript<br>
><br>
> Can you elaborate on what JSC is and how you do the query? Is it something like:<br>
> * build an interpreter<br>
> * interpret javascript code that prints infinity<br>
> * check for expected value<br>
><br>
> I know zero about javascript in general but if we can get a script to<br>
> do that then we could bisect it. It'll take a while but we (Linaro)<br>
> have access to some machines that could help there.<br>
> (assuming this presents on armv8 hardware, but if it doesn't it's at<br>
> least a data point)<br>
><br>
> > It seems like some optimization introduced by -O2 is causing the issue.<br>
><br>
> Agreed<br>
><br>
> > Is there a flag in clang to print which optimizations are enabled for -O1 and -O2 so I can diff them?<br>
><br>
> Yes but I can never remember which one it is, so let me try to find<br>
> it. Unless someone else knows it already and can reply.<br>
><br>
> On Sat, 11 Dec 2021 at 18:01, Mikhail R. Gadelha via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> ><br>
> > Hi everyone,<br>
> ><br>
> > This is kind of a follow-up to my previous email about compiling JSC using clang for ARMv7: when I build JSC using either -O2 or -O3, I get random garbage when querying for the "Infinity" constant from javascript, as if the constant was not being initialized. The variable is being initialized correctly, that I'm sure.<br>
> ><br>
> > Some tests I did:<br>
> > 1. Using -O1 or no optimization doesn't trigger the issue.<br>
> > 2. Using either -O2 or -O3 with address or the undef behavior sanitizers doesn't trigger the issue.<br>
> > 3. Building JSC with clang 11.0.1-2 (from Debian) and clang 12.0.1 (from github) doesn't trigger the issue.<br>
> > 4. The issue happens with clang 13.0.0 (from github) and the 13.0.1-rc1 (also from github).<br>
> ><br>
> > It seems like some optimization introduced by -O2 is causing the issue.<br>
> ><br>
> > Does anyone have any tips I can follow to improve this bug report? I'll try to compile JSC with -O2 and disable the optimizations manually to pinpoint what's causing the issue (hopefully it's a single optimization and not a combination of them). Is there a flag in clang to print which optimizations are enabled for -O1 and -O2 so I can diff them?<br>
> ><br>
> > I wish I had more information, but I'm still trying to debug why this is happening. I wanted to try to get more information first before opening a github issue.<br>
> ><br>
> > Thanks in advance,<br>
> ><br>
> > --<br>
> ><br>
> > Mikhail R. Gadelha.<br>
> > _______________________________________________<br>
> > cfe-dev mailing list<br>
> > <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
> > <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div></div>