Thanks for working on this.<br><br>I hate to do this to you - but did you run the Clang tests after your change to DIBuilder? DIBuilder is, unfortunately, not tested by LLVM's tests - but is indirectly tested by Clang's debug info IRGen level tests.<br>
<br>I'd be more than happy to remove that weird zero-length arrays are emitted as arrays with a single zero. I assumed there was an IR limitation (that we couldn't have zero-length metadata values) that created this situation, but I never went to look/verify that that was actually the case.<br>
<br>(we can remove a bunch of conditionals that can just become asserts if we can remove that zero/one/i32 0 array encoding weirdness)<br><br>If it passes Clang's tests, it's probably worth committing that change separately.<br>
<br>The loop that adds the new subprogram to the CUs' subprogram lists could probably just bail out once it finds a single copy - that list shouldn't contain duplicates.<br><br>I'd have to think more about whether what you've done is sufficient for the duplication. I have a sneaking suspicion that it isn't - what happens to the dbg_declare/dbg_value intrinsics in the cloned function? What variables do they point to? what context do those variables point to? (I suspect they point back to the original, not the cloned, function, which could be problematic)<br>
 <br><div>On Thu Jan 02 2014 at 7:47:28 AM, Mishne, Alon <<a href="mailto:alon.mishne@intel.com" target="_blank">alon.mishne@intel.com</a>> wrote:</div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p>Right now CloneFunction ignores the debug info metadata, which can lead to debug info loss when the cloned function is used. This patch modifies that so that if the 'ModuleLevelChanges' parameter to CloneFunction is true, any debug info
 metadata for the old function is cloned for the new function.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Also expanded the cloning unit tests to test for this new functionality.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><span lang="EN" style="color:black">Additionally, one of my tests required checking for an empty DIArray, but apparently DIBuilder doesn't make those - if asked to create an empty array, it creates an array with a single "null" value instead.
 I've changed DIBuilder to no longer do that because I don't understand why it's done and all the tests still pass after the change.</span><u></u><u></u></p>
</div>
<p>------------------------------<u></u>------------------------------<u></u>---------<br>
Intel Israel (74) Limited</p>

<p>This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</p></div>

</blockquote>