<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">(Cc llvm-dev, whoops!)<div><blockquote type="cite" class=""></blockquote><font color="#5856d6" class=""><br class=""></font>Intuitively, no, but suppose you have a sequence of instructions that look like this (in some weird pseudocode I just made up)<br class=""><font color="#5856d6" class=""><br class=""></font>a<br class="">b<br class="">c<br class="">x<br class="">a<br class="">b<br class="">c<br class=""><font color="#5856d6" class=""><br class=""></font>Now, this could be reduced to something that looks like this by an outliner:<br class=""><font color="#5856d6" class=""><br class=""></font>call my_function<br class="">x<br class="">call my_function<br class=""><font color="#5856d6" class=""><br class=""></font>my_function:<br class="">a<br class="">b<br class="">c<br class="">return<br class=""><font color="#5856d6" class=""><br class=""></font>Structurally-speaking, this *is* a reduction.<br class=""><font color="#5856d6" class=""><br class=""></font>Now, suppose we’re using an architecture like AArch64 where we care about something like a link register. Then to be correct we may have to actually emit something like this:<br class=""><font color="#5856d6" class=""><br class=""></font>save special_register<br class="">call my_function<br class="">restore special_register<br class="">x<br class="">save special_register<br class="">call my_function<br class="">restore special_register<br class=""><font color="#5856d6" class=""><br class=""></font>my_function:<br class="">a<br class="">b<br class="">c<br class="">return<br class=""><font color="#5856d6" class=""><br class=""></font>In this case, we’ve actually produced more instructions than before. Although we’ve simplified the structure of the code, we’ve still produced more of it. So, if a high-level outliner isn’t aware of this sort of thing, you could actually end up making binaries *larger* by removing similarity from the code.<br class=""><font color="#5856d6" class=""><br class=""></font>- Jessica<br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Jul 24, 2017, at 2:16 PM, Meador Inge <<a href="mailto:meadori@gmail.com" class="">meadori@gmail.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">Firstly, as previously mentioned, we don’t know how an instruction will be lowered. So, if we say that each IR instruction has a cost of “1 somethings”, we haven’t really solved a *code size problem*, but more of a *code reduction problem*. That is, we’ve performed a reduction to the overall structure of the program, but we don’t know that that overall structural reduction will produce an equivalent code size reduction. I personally would be inclined to figure out how far off such a cost model could be, given a known architecture.<br class=""></blockquote><br class="">“code size” vs. “code reduction” seems like a really nice way to think about this.  I don’t know a lot about the areas in discussion, but one thing that occurred to me while reading this was: a code reduction couldn’t produce a worse code size than without the reduction, right?<br class=""><br class="">— Meador<br class=""><br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></body></html>