<html><head><base href="x-msg://2091/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Feb 12, 2012, at 1:11 PM, Rotem, Nadav wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-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: 0px; font-size: medium; "><div lang="EN-US" link="blue" vlink="purple"><div class="WordSection1" style="page: WordSection1; "><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Hi,<o:p></o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; "><o:p> </o:p></div><div style="margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif; ">Last year we talked about the problem of LLVM duplicating function calls that are considered 'barrier' in data-parallel languages, such as OpenCL. I implemented Eli's proposal[1] to add a new function attribute (executebarrier) which prevents the duplication of barriers in a number of LLVM optimizations. I still need to handle the loop unswitch pass and review a few other passes.</div></div></div></span></blockquote><br></div><div>Hi Nadav,</div><div><br></div><div>Sorry for the delay getting to this. IIUC, the key functionality that you're looking for here is to prevent the optimizing from duplicating certain calls. If that's what you're looking for, I'd propose something like this:</div><div><br></div><div>1. New function attribute, "noduplicate" or something like that.</div><div>2. Update the code metrics inlining cost calculation stuff to treat calls to functions with this new attribute as not duplicatable (similar to noinline for the inliner).</div><div>3. Update the optimizer to use the code metrics in all places where it is duplicating pieces of code.</div><div><br></div><div>#3 is really the clincher for me. I really don't want random checks for this new attribute scattered throughout the optimizer, and having the optimizer use common code to determine duplication cost is general goodness anyway.</div><div><br></div><div>-Chris</div><div><br></div><br></body></html>