<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 24 Jul 2019 at 10:52, Oliver Stannard via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Your script looks OK, though you won't want to use the -opt-bisect-limit= option until you've found a case where code-generation changes. Instead, that's a tool which you could use to narrow down the pass inside LLVM which is causing the change.<div><br></div><div>The problem is that your input code is far too simple to trigger any interesting optimisations. I'd suggest starting with either some code from the LLVM test suite (<a href="https://github.com/llvm/llvm-test-suite" target="_blank">https://github.com/llvm/llvm-test-suite</a>), or some code generated by csmith (<a href="https://embed.cs.utah.edu/csmith/" target="_blank">https://embed.cs.utah.edu/csmith/</a>). The former has the advantage of being (mostly) real code people actually write, and the latter can generate a large amount of complex code without any external dependencies (so it's easy to build).</div><div><br></div></div></blockquote><div><br></div><div>A few other things to note:</div><div><br></div><div>There's a tool in clang here ( <a href="https://github.com/llvm/llvm-project/tree/master/clang/utils/check_cfc">https://github.com/llvm/llvm-project/tree/master/clang/utils/check_cfc</a> ) called check_cfc which uses the same basic idea as the script above.  It's designed to transparently wrap clang invocations so that any differences in codegen will actually trigger a build failure.  There are a few more details in these slides ( <a href="https://llvm.org/devmtg/2015-04/slides/Verifying_code_gen_dash_g_final.pdf">https://llvm.org/devmtg/2015-04/slides/Verifying_code_gen_dash_g_final.pdf</a> ).  Ultimately it doesn't matter which tools you use in order to find bugs, but you may find it useful.</div><div><br></div><div>We've got a meta-bug here to which we've been attaching already-reported bugs in this area ( <a href="https://bugs.llvm.org/show_bug.cgi?id=37728">https://bugs.llvm.org/show_bug.cgi?id=37728</a> ) which might be a nice place to start so that you can try replicating the results.  In particular <a href="https://bugs.llvm.org/show_bug.cgi?id=42138">https://bugs.llvm.org/show_bug.cgi?id=42138</a> is a bug that one of our interns found recently using the check_cfc script with llvm test-suite (and then reducing with creduce).  Unfortunately it was right at the end of his internship so he didn't get a chance to try and fix it. It might be a good starting point to have a go at replicating the failure and then trying to figure out what's happening and fixing it (assuming that it's still present).  I'm sure that there are plenty of people in the community willing to help out with any specific issues you run into along the way.</div><div><br></div><div>Good luck, with whichever approach you take!</div><div><br></div><div>-Greg</div><div><br></div><div><br></div><div><br></div><div> </div></div></div>