<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 22, 2008, at 4:40 PM, Devang Patel wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><font class="Apple-style-span" face="Courier">The LLVM passes are responsible to take appropriate actions based on Function </font></div><div><font class="Apple-style-span" face="Courier">Notes associated with function definition. For example, </font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">define void @fn1()  notes("opt-size=1") { ... }</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">The function fn1() is being optimized for size without losing significant </font></div><div><font class="Apple-style-span" face="Courier">performance. The inliner will update inlining threshold for fn1() such that the </font></div><div><font class="Apple-style-span" face="Courier">functions called by fn1() are checked for size threshold for fn1() while being </font></div><div><font class="Apple-style-span" face="Courier">inlined inside fn1(). If the function fn1() is itself inlined somewhere, for </font></div><div><font class="Apple-style-span" face="Courier">example bar(), then the inlining threshold for bar() will be the deciding factor. </font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">define void @fn2()  notes("opt-size=2") { ... }</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">The function fn2() is aggressively optimized for size. The code generator may </font></div><div><font class="Apple-style-span" face="Courier">sacrifice performance while selecting instructions. The inliner will aggressively </font></div><div><font class="Apple-style-span" face="Courier">reduce inlining threshold.</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">define void @fn3() notes("noinline") { ... }</font></div><div><font class="Apple-style-span" face="Courier">define void @fn4() notes("always_inline") { ... }</font></div><div><font class="Apple-style-span" face="Courier">define void @fn5() notes("noinline,always_inline") { ... }</font></div></span></blockquote><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">Here the inliner is instructed to not inline function fn3() anywhere and inline </font></div><div><font class="Apple-style-span" face="Courier">function fn4() everywhere. The function fn5() is malformed and it should be </font></div><div><font class="Apple-style-span" face="Courier">rejected by the verifier.</font></div></span></blockquote></div><br><div><div>Since you opened the door with values for opt-size,  couldn't we do the same for inlining.  That is:</div><div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">  define void @fn3() notes("inline=never") { ... }</font></div><div><font class="Apple-style-span" face="Courier">  define void @fn4() notes("inline=always") { ... }</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div></div><div>Then the general rule is that there can be only one "foo=" in the set of notes.   I know this won't make the __attribute__ keywords, but it would make the function notes cleaner.</div><div><br></div><div>Also, could there be a name for 1 and 2 on opt-size?   What happens when we find a need for a third kind of opt-size...</div><div><br></div><div><br></div><div>These seem like great default parameters for code-gen, but looking forward, if we also allowed some optimization flags to be specified at LTO time, how would they interact?  </div><div><br></div>-Nick</div><div><br></div></body></html>