It is better to update pointer of the DISuprogram before we call RAUW for still live arguments of the function, because with D42541 in RAUW we compare DISubprograms rather than functions itself.
Details
Diff Detail
Event Timeline
The change LGTM, but now I wonder why this didn't break any tests. Are we missing coverage here?
@aprantl All test cases pass. That is why RAUW has redundant check (getLocalFunctionMetadata for From and To). Maybe in some cases LLVM PASS just did not get the place where actually it updates the pointer to the DISubprogram (or it was pointer to the function before D42541) and if it is null at that particular point that does not mean that it clobbers dbg info (because it would be != than other metadata at the time).
@djtodoro thanks, this change looks nice, it makes the code easier to read too!
Just a suggestion, could we just set the Subprogram earlier where we set all of the
more basic properties of the function, when NF is created around line 819, or is
that too soon?