<div dir="ltr">Fair enough - thought maybe we had existing precedent for cloning+modifying debug info, so thought it might be something we could reuse. But I can't think of especially which optimization pass might be doing that... maybe arg promotion? But I guess that doesn't create more functions, it probably just creates one new function and destroys the old one.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 18, 2018 at 11:44 AM Adrian Prantl via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">aprantl added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/CodeGen/MachineOutliner.cpp:1288-1295<br>
+      DISubprogram *SP = DB->createFunction(<br>
+          Unit /* Context */, F->getName(),<br>
+          StringRef() /* Empty linkage name. */, Unit /* File */,<br>
+          0 /* Line numbers don't matter*/,<br>
+          DB->createSubroutineType(DB->getOrCreateTypeArray(None)), /* void */<br>
+          false, true, 0, /* Line in scope doesn't matter*/<br>
+          DINode::DIFlags::FlagArtificial /* Compiler-generated code. */,<br>
----------------<br>
dblaikie wrote:<br>
> Any chance of cloning the DISubprogram from the original function, then modifying it? Or does it seem better to create a separate one like this? I guess this is fine (Adrian?)<br>
Since it will be a distinct MDNode modifying the clone is technically legal, but I don't consider it good practice. I think this approach is cleaner and easier to understand.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D42254" rel="noreferrer" target="_blank">https://reviews.llvm.org/D42254</a><br>
<br>
<br>
<br>
</blockquote></div>