[llvm] [MemProf] Merge callee clones as needed before assigning functions (PR #135702)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 17:11:08 PDT 2025


teresajohnson wrote:

Uploading pngs created from the dot files exported for new test case mergenodes.ll to better illustrate the issue and the fixed versions. Files:
- mergenodes.ll.tmp.ccg.postbuild.png: Before any cloning. It isn't possible to see from the png version of the dot files, but the two calls to foo() from main() reach the two allocations in bar() with opposite allocation hotness.
- mergenodes.ll.tmp.ccg.cloned.png: After cloning. The differing allocation behavior reached from each path is exposed. However, note that each callsite in main calls two different clones of foo, which isn't possible in practice.
- mergenodes.ll.tmp.ccg.clonefuncassign.BAD.png: After function assignment without this patch. Function assignment gets confused and we end up calling the same clones for everything.
- mergenodes.ll.tmp.ccg.aftermerge.png: After the merging step added in this patch. We still have exposed the differing allocation behavior from each path, but with sane edges
- mergenodes.ll.tmp.ccg.clonefuncassign.png: After function assignment, now correct.

![mergenodes ll tmp ccg aftermerge](https://github.com/user-attachments/assets/80d9c51d-e5d4-4a9c-9205-aa151ac88df2)
![mergenodes ll tmp ccg cloned](https://github.com/user-attachments/assets/c85e2125-8925-4443-ba1c-7f719d75a724)
![mergenodes ll tmp ccg clonefuncassign BAD](https://github.com/user-attachments/assets/4d660af9-2ab6-457b-b515-0e4f08b3f600)
![mergenodes ll tmp ccg clonefuncassign](https://github.com/user-attachments/assets/1f8f5d2d-800d-46e9-883f-a1efe56f09ac)
![mergenodes ll tmp ccg postbuild](https://github.com/user-attachments/assets/0e4b1404-1fcd-46d0-8dca-58592b298f18)


https://github.com/llvm/llvm-project/pull/135702


More information about the llvm-commits mailing list