<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 11, 2014 at 4:23 PM, Chris Bieneman <span dir="ltr"><<a href="mailto:cbieneman@apple.com" target="_blank">cbieneman@apple.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I’ve got some new patches and some numbers.</div><div><br></div><div>The patches are all the changes required to strip intrinsics using the preprocessor defines I showed in my earlier patches. It actually isn’t that much change to LLVM. Clang will need similar changes too. There were only 9 files that referenced target intrinsics outside the corresponding target.</div><div><br></div><div>These patches are still WIP, and there is some nastiness, but they work.</div><div><br></div><div>Using these patches I see about 500k reduction in binary size when building libLLVM.dylib with just the ARM backend enabled.</div><div><br></div><div><div style="margin:0px;font-family:'Andale Mono';color:rgb(56,193,255);background-color:rgb(0,0,0)"><span style="color:#29f914">> </span><span style="color:#457bf9">du</span><span style="color:#29f914"> </span>-k<span style="color:#29f914"> </span>../<span style="color:#34bbc7">*</span>.dylib</div><div style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">34236<span style="white-space:pre-wrap">      </span>../libLLVM-ARM-only-after.dylib</div><div style="margin:0px;font-family:'Andale Mono';color:rgb(41,249,20);background-color:rgb(0,0,0)">34732<span style="white-space:pre-wrap">     </span>../libLLVM-ARM-only-before.dylib</div></div><div><br></div><div>These savings are substantial for our use case.</div></div></blockquote><div><br></div><div>I'm sort of curious that ~1.5% savings is "substantial". It smells of diminishing returns/microoptimization. If there is really such a dire need for size, surely there are whole parts of the API that aren't used by your application and could be stripped for much greater benefit?</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div><div><br></div><div></div></font></span></div><br><div style="word-wrap:break-word"><div></div><div><blockquote type="cite"><div>On Dec 10, 2014, at 5:39 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:</div><br><div><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Wed Dec 10 2014 at 5:37:06 PM Chris Bieneman <<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><blockquote type="cite"><div>On Dec 10, 2014, at 4:22 PM, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:</div><br><div><br><br><div class="gmail_quote">On Wed Dec 10 2014 at 3:57:25 PM Chris Bieneman <<a href="mailto:beanz@apple.com" target="_blank">beanz@apple.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">llvm-dev,<br><br>In my ongoing saga to improve LLVM for embedded use, we would like to support stripping out unused intrinsics based on the LLVM targets actually being built.<br><br>I’ve attached two patches.<br><br>The first is a new flag for tablegen to take a list of targets. If passed tablegen will only emit intrinsics that either have empty target prefixes, or target prefixes matching one of the targets in the list. If the flag is not passed the behavior is unchanged. This patch can land today (subject to review).<br><br>The second patch is a WIP, and adds support to the CMake build system for using the new tablegen flag, and for generating a new llvm/Config/llvm-targets.h header which contains defines for each target specified with LLVM_TARGETS_TO_BUILD.<br><br>This new header will allow us to #ifdef code using target-specific intrinsics outside the targets, thus allowing us to strip out all the unused intrinsics.<br><br></blockquote><div><br></div><div>I like the general idea and, as you asked on irc, will happily help with the autoconf changes. Do you have a small (even pseudo) code example of what the changes to the middle end machinery will look like?</div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word"><div><div>The big change required outside the patches on my first email is that any use of a target intrinsic will need to be #ifdef’d. I haven’t tracked all of those down yet.</div></div></div><div style="word-wrap:break-word"><div><div><br></div></div></div></blockquote><div><br></div><div>That's a little gross. I wonder if there's a better abstraction for this - I think the "check if a preprocessor define" is valid would be painful for maintenance and testing.</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div></div><div>-Chris</div></div></div><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div class="gmail_quote"><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">-Chris<br><br>______________________________<u></u>_________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvmdev</a></blockquote></div></div></blockquote></div></div></blockquote></div></div></blockquote></div><br></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div></div></div>