<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 13, 2017, at 5:23 PM, Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" class="">moritz.angermann@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Mar 14, 2017, at 3:02 AM, Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" class="">mehdi.amini@apple.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class=""><br class="">On Mar 11, 2017, at 4:30 PM, Moritz Angermann via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi Matthias,<br class=""><br class="">what I’m observing right now is that replacing opt+llc with an clang invocation, and<br class="">subsequently fewer intermediate files, increases the consumed time with -O0 by 200%.<br class="">We used to always run opt with -mem2reg -globalopt, and I believe those are not part<br class="">of -O0 (is there an easy way to list all passes that -OX flags to clang imply for the<br class="">optimizer and code gen?).<br class=""></blockquote><br class="">No there isn’t.<br class=""><br class=""><br class=""><blockquote type="cite" class="">Could the IR imply certain optimization passes to be required? Could llvm be taught<br class="">that say a certain calling convention needs a pass to run?<br class=""></blockquote><br class="">This could be done, but we’d need to here more about the motivation. I suspect the solution may end up different if we understand the exact use-case.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sure. This is all about the ghccc. Here the original discussion between Chris Lattner</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">and David Terei who initially implemented the llvm backend for ghc:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://www.nondot.org/sabre/LLVMNotes/GlobalRegisterVariables.txt</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote><div><br class=""></div><div>From that discussion I don't see why you need mem2reg or globalopt. Sure those things are desirable to eliminate the extra copies and get performant code, but for that you wouldn't use -O0 anyway...</div><div><br class=""></div><div>- Matthias</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Cheers,</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">moritz</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">—<span class="Apple-converted-space"> </span><br class="">Mehdi<br class=""><br class=""><br class=""><br class=""><blockquote type="cite" class=""><br class="">Cheers,<br class="">Moritz<br class=""><br class=""><blockquote type="cite" class="">On Mar 12, 2017, at 3:41 AM, Matthias Braun <<a href="mailto:matze@braunis.de" class="">matze@braunis.de</a>> wrote:<br class=""><br class="">-mllvm xxx will pass options directly to the llvm libraries though for that the same caveats apply in that they are more of a developer/debug tool than a stable interface.<br class="">The stable interface to clang is the usual flags like -O0/-O3/-fXXX/-mXXX ...<br class=""><br class="">If you find yourself in a position that you want to control the pass pipeline down to single passes (why would you want to enable/disable mem2reg really?) then you are relying on LLVM internals anyway. If you need/want that level of control then your best bet would be to link against the LLVM libraries or I guess shipping and relying on llc/opt is similarily good/bad. It will work but you will have to do more work to keep track with llvm releases, development of new passes, new behaviors, ...<br class=""><br class="">- Matthias<br class=""><br class=""><blockquote type="cite" class="">Am 10.03.2017 um 23:50 schrieb Moritz Angermann <<a href="mailto:moritz.angermann@gmail.com" class="">moritz.angermann@gmail.com</a>>:<br class=""><br class="">Hi Matthias,<br class=""><br class="">I’m trying to see if I can make do with the clang interface only.<br class="">How do I pass flags to opt or llc? Say I want to enable/disable tbaa,<br class="">which could be done with `--enable-tbaa=true/false` or `-mem2reg` or<br class="">`-globalopt`? Would the `-llvm` switch be, what I’m looking for or the<br class="">`-Xclang`, or something else entirely?<br class=""><br class="">Cheers,<br class="">Moritz<br class=""><br class=""><blockquote type="cite" class="">On Mar 11, 2017, at 2:26 AM, Matthias Braun <<a href="mailto:mbraun@apple.com" class="">mbraun@apple.com</a>> wrote:<br class=""><br class="">Just a word of warning:<br class=""><br class="">llc and opt are primarily developed as debugging tools to support LLVM testing. They are not intended to be shipped or used as code generators for frontends. They do often work in these settings but you may hit rough edges that nobody will care to fix and the behavior or commandline interface may change every release... A more stable alternative is usually to feed .ir/.bc files to clang or better link to the llvm libraries and generate the code from there.<br class=""><br class="">- Matthias<br class=""><br class=""><blockquote type="cite" class="">On Mar 10, 2017, at 6:31 AM, Moritz Angermann via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi,<br class=""><br class="">I was wondering, if someone could point me into the right direction,<br class="">towards building just llc and opt (potentially 4.0 + patches) to distribute<br class="">them in the interim with compiler? The idea is that we’d like to pin our<br class="">llvm ir code generator to a specific set of llc and opt tools, with<br class="">potential patches applied, until we manage to get all those patches<br class="">upstreamed.<br class=""><br class="">I’d like to find answers to the following question:<br class="">- How trivially can I build just llc and opt into (maybe static?)<br class="">distributable binaries?<br class="">- Would generating them for multiple architectures pose any specific<br class="">complications?<br class=""><br class="">Cheers,<br class="">Moritz<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></blockquote><br class=""></blockquote><br class=""></blockquote></blockquote><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</blockquote></blockquote></div></blockquote></div><br class=""></body></html>